@marko/language-server 1.1.7 → 1.1.9
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.js
CHANGED
|
@@ -25,16 +25,31 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
// src/index.ts
|
|
26
26
|
var import_util2 = require("util");
|
|
27
27
|
var import_node = require("vscode-languageserver/node");
|
|
28
|
-
var
|
|
28
|
+
var import_language_tools19 = require("@marko/language-tools");
|
|
29
29
|
|
|
30
|
-
// src/utils/
|
|
30
|
+
// src/utils/project-defaults.ts
|
|
31
31
|
var import_path = __toESM(require("path"));
|
|
32
|
+
var defaultCompiler = __toESM(require("@marko/compiler"));
|
|
33
|
+
var import_config = __toESM(require("@marko/compiler/config"));
|
|
34
|
+
var defaultTranslator = __toESM(require("@marko/translator-default"));
|
|
32
35
|
var import_language_tools = require("@marko/language-tools");
|
|
36
|
+
import_language_tools.Project.setDefaultTypePaths({
|
|
37
|
+
internalTypesFile: import_path.default.join(__dirname, "marko.internal.d.ts"),
|
|
38
|
+
markoTypesFile: import_path.default.join(__dirname, "marko.runtime.d.ts")
|
|
39
|
+
});
|
|
40
|
+
import_language_tools.Project.setDefaultCompilerMeta(defaultCompiler, {
|
|
41
|
+
...import_config.default,
|
|
42
|
+
translator: defaultTranslator
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// src/utils/file.ts
|
|
46
|
+
var import_path2 = __toESM(require("path"));
|
|
47
|
+
var import_language_tools2 = require("@marko/language-tools");
|
|
33
48
|
var import_vscode_uri = require("vscode-uri");
|
|
34
49
|
var processorCaches = /* @__PURE__ */ new WeakMap();
|
|
35
50
|
function getFSDir(doc) {
|
|
36
51
|
const filename = getFSPath(doc);
|
|
37
|
-
return filename &&
|
|
52
|
+
return filename && import_path2.default.dirname(filename);
|
|
38
53
|
}
|
|
39
54
|
function getFSPath(doc) {
|
|
40
55
|
const parsed = import_vscode_uri.URI.parse(doc.uri);
|
|
@@ -44,14 +59,14 @@ function getMarkoFile(doc) {
|
|
|
44
59
|
const { uri } = doc;
|
|
45
60
|
const { fsPath, scheme } = import_vscode_uri.URI.parse(uri);
|
|
46
61
|
const filename = scheme === "file" ? fsPath : void 0;
|
|
47
|
-
const dirname = filename ?
|
|
48
|
-
const cache =
|
|
62
|
+
const dirname = filename ? import_path2.default.dirname(filename) : process.cwd();
|
|
63
|
+
const cache = import_language_tools2.Project.getCache(dirname);
|
|
49
64
|
let file = cache.get(doc);
|
|
50
65
|
if (!file) {
|
|
51
66
|
const { version } = doc;
|
|
52
67
|
const code = doc.getText();
|
|
53
|
-
const parsed = (0,
|
|
54
|
-
const lookup =
|
|
68
|
+
const parsed = (0, import_language_tools2.parse)(code, filename);
|
|
69
|
+
const lookup = import_language_tools2.Project.getTagLookup(dirname);
|
|
55
70
|
cache.set(
|
|
56
71
|
doc,
|
|
57
72
|
file = {
|
|
@@ -69,7 +84,7 @@ function getMarkoFile(doc) {
|
|
|
69
84
|
return file;
|
|
70
85
|
}
|
|
71
86
|
function clearMarkoCacheForFile(doc) {
|
|
72
|
-
|
|
87
|
+
import_language_tools2.Project.getCache(getFSDir(doc)).delete(doc);
|
|
73
88
|
}
|
|
74
89
|
function processDoc(doc, process2) {
|
|
75
90
|
const file = getMarkoFile(doc);
|
|
@@ -296,680 +311,586 @@ var import_vscode_languageserver12 = require("vscode-languageserver");
|
|
|
296
311
|
|
|
297
312
|
// src/service/html/index.ts
|
|
298
313
|
var import_axe_core = __toESM(require("axe-core"));
|
|
299
|
-
var
|
|
314
|
+
var import_language_tools3 = require("@marko/language-tools");
|
|
300
315
|
var import_jsdom = require("jsdom");
|
|
301
316
|
|
|
302
317
|
// src/service/html/axe-rules/axe-rules.ts
|
|
303
318
|
var keyboard = {
|
|
304
319
|
/**
|
|
305
320
|
* - Ensures every accesskey attribute value is unique
|
|
306
|
-
* - accesskey attribute value should be unique ([url](https://dequeuniversity.com/rules/axe/4.
|
|
321
|
+
* - accesskey attribute value should be unique ([url](https://dequeuniversity.com/rules/axe/4.7/accesskeys?application=axeAPI))
|
|
307
322
|
*/
|
|
308
323
|
accesskeys: "accesskeys",
|
|
309
324
|
/**
|
|
310
325
|
* - Ensures each page has at least one mechanism for a user to bypass navigation and jump straight to the content
|
|
311
|
-
* - Page must have means to bypass repeated blocks ([url](https://dequeuniversity.com/rules/axe/4.
|
|
326
|
+
* - Page must have means to bypass repeated blocks ([url](https://dequeuniversity.com/rules/axe/4.7/bypass?application=axeAPI))
|
|
312
327
|
*/
|
|
313
328
|
bypass: "bypass",
|
|
314
329
|
/**
|
|
315
330
|
* - Ensures elements in the focus order have a role appropriate for interactive content
|
|
316
|
-
* - Elements in the focus order should have an appropriate role ([url](https://dequeuniversity.com/rules/axe/4.
|
|
331
|
+
* - Elements in the focus order should have an appropriate role ([url](https://dequeuniversity.com/rules/axe/4.7/focus-order-semantics?application=axeAPI))
|
|
317
332
|
*/
|
|
318
333
|
focusOrderSemantics: "focus-order-semantics",
|
|
319
334
|
/**
|
|
320
335
|
* - Ensures `<frame>` and `<iframe>` elements with focusable content do not have tabindex=-1
|
|
321
|
-
* - Frames with focusable content must not have tabindex=-1 ([url](https://dequeuniversity.com/rules/axe/4.
|
|
336
|
+
* - Frames with focusable content must not have tabindex=-1 ([url](https://dequeuniversity.com/rules/axe/4.7/frame-focusable-content?application=axeAPI))
|
|
322
337
|
*/
|
|
323
338
|
frameFocusableContent: "frame-focusable-content",
|
|
324
339
|
/**
|
|
325
340
|
* - Ensures interactive controls are not nested as they are not always announced by screen readers or can cause focus problems for assistive technologies
|
|
326
|
-
* - Interactive controls must not be nested ([url](https://dequeuniversity.com/rules/axe/4.
|
|
341
|
+
* - Interactive controls must not be nested ([url](https://dequeuniversity.com/rules/axe/4.7/nested-interactive?application=axeAPI))
|
|
327
342
|
*/
|
|
328
343
|
nestedInteractive: "nested-interactive",
|
|
329
344
|
/**
|
|
330
345
|
* - Ensures all page content is contained by landmarks
|
|
331
|
-
* - All page content should be contained by landmarks ([url](https://dequeuniversity.com/rules/axe/4.
|
|
346
|
+
* - All page content should be contained by landmarks ([url](https://dequeuniversity.com/rules/axe/4.7/region?application=axeAPI))
|
|
332
347
|
*/
|
|
333
348
|
region: "region",
|
|
334
349
|
/**
|
|
335
350
|
* - Ensure elements that have scrollable content are accessible by keyboard
|
|
336
|
-
* - Scrollable region must have keyboard access ([url](https://dequeuniversity.com/rules/axe/4.
|
|
351
|
+
* - Scrollable region must have keyboard access ([url](https://dequeuniversity.com/rules/axe/4.7/scrollable-region-focusable?application=axeAPI))
|
|
337
352
|
*/
|
|
338
353
|
scrollableRegionFocusable: "scrollable-region-focusable",
|
|
339
354
|
/**
|
|
340
355
|
* - Ensure all skip links have a focusable target
|
|
341
|
-
* - The skip-link target should exist and be focusable ([url](https://dequeuniversity.com/rules/axe/4.
|
|
356
|
+
* - The skip-link target should exist and be focusable ([url](https://dequeuniversity.com/rules/axe/4.7/skip-link?application=axeAPI))
|
|
342
357
|
*/
|
|
343
358
|
skipLink: "skip-link",
|
|
344
359
|
/**
|
|
345
360
|
* - Ensures tabindex attribute values are not greater than 0
|
|
346
|
-
* - Elements should not have tabindex greater than zero ([url](https://dequeuniversity.com/rules/axe/4.
|
|
361
|
+
* - Elements should not have tabindex greater than zero ([url](https://dequeuniversity.com/rules/axe/4.7/tabindex?application=axeAPI))
|
|
347
362
|
*/
|
|
348
363
|
tabindex: "tabindex"
|
|
349
364
|
};
|
|
350
365
|
var textAlternatives = {
|
|
351
366
|
/**
|
|
352
367
|
* - Ensures `<area>` elements of image maps have alternate text
|
|
353
|
-
* - Active `<area>` elements must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
368
|
+
* - Active `<area>` elements must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.7/area-alt?application=axeAPI))
|
|
354
369
|
*/
|
|
355
370
|
areaAlt: "area-alt",
|
|
356
371
|
/**
|
|
357
372
|
* - Ensures each HTML document contains a non-empty `<title>` element
|
|
358
|
-
* - Documents must have `<title>` element to aid in navigation ([url](https://dequeuniversity.com/rules/axe/4.
|
|
373
|
+
* - Documents must have `<title>` element to aid in navigation ([url](https://dequeuniversity.com/rules/axe/4.7/document-title?application=axeAPI))
|
|
359
374
|
*/
|
|
360
375
|
documentTitle: "document-title",
|
|
361
376
|
/**
|
|
362
377
|
* - Ensures `<iframe>` and `<frame>` elements contain a unique title attribute
|
|
363
|
-
* - Frames must have a unique title attribute ([url](https://dequeuniversity.com/rules/axe/4.
|
|
378
|
+
* - Frames must have a unique title attribute ([url](https://dequeuniversity.com/rules/axe/4.7/frame-title-unique?application=axeAPI))
|
|
364
379
|
*/
|
|
365
380
|
frameTitleUnique: "frame-title-unique",
|
|
366
381
|
/**
|
|
367
382
|
* - Ensures `<iframe>` and `<frame>` elements have an accessible name
|
|
368
|
-
* - Frames must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
383
|
+
* - Frames must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/frame-title?application=axeAPI))
|
|
369
384
|
*/
|
|
370
385
|
frameTitle: "frame-title",
|
|
371
386
|
/**
|
|
372
387
|
* - Ensures `<img>` elements have alternate text or a role of none or presentation
|
|
373
|
-
* - Images must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
388
|
+
* - Images must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.7/image-alt?application=axeAPI))
|
|
374
389
|
*/
|
|
375
390
|
imageAlt: "image-alt",
|
|
376
391
|
/**
|
|
377
392
|
* - Ensure image alternative is not repeated as text
|
|
378
|
-
* - Alternative text of images should not be repeated as text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
393
|
+
* - Alternative text of images should not be repeated as text ([url](https://dequeuniversity.com/rules/axe/4.7/image-redundant-alt?application=axeAPI))
|
|
379
394
|
*/
|
|
380
395
|
imageRedundantAlt: "image-redundant-alt",
|
|
381
396
|
/**
|
|
382
397
|
* - Ensures `<input type="image">` elements have alternate text
|
|
383
|
-
* - Image buttons must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
398
|
+
* - Image buttons must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.7/input-image-alt?application=axeAPI))
|
|
384
399
|
*/
|
|
385
400
|
inputImageAlt: "input-image-alt",
|
|
386
401
|
/**
|
|
387
402
|
* - Ensures `<object>` elements have alternate text
|
|
388
|
-
* - `<object>` elements must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
403
|
+
* - `<object>` elements must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.7/object-alt?application=axeAPI))
|
|
389
404
|
*/
|
|
390
405
|
objectAlt: "object-alt",
|
|
391
406
|
/**
|
|
392
|
-
* - Ensures [role=
|
|
393
|
-
* - [role=
|
|
407
|
+
* - Ensures [role='img'] elements have alternate text
|
|
408
|
+
* - [role='img'] elements must have an alternative text ([url](https://dequeuniversity.com/rules/axe/4.7/role-img-alt?application=axeAPI))
|
|
394
409
|
*/
|
|
395
410
|
roleImgAlt: "role-img-alt",
|
|
396
411
|
/**
|
|
397
412
|
* - Ensures that server-side image maps are not used
|
|
398
|
-
* - Server-side image maps must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
413
|
+
* - Server-side image maps must not be used ([url](https://dequeuniversity.com/rules/axe/4.7/server-side-image-map?application=axeAPI))
|
|
399
414
|
*/
|
|
400
415
|
serverSideImageMap: "server-side-image-map",
|
|
401
416
|
/**
|
|
402
417
|
* - Ensures `<svg>` elements with an img, graphics-document or graphics-symbol role have an accessible text
|
|
403
|
-
* - `<svg>` elements with an img role must have an alternative text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
418
|
+
* - `<svg>` elements with an img role must have an alternative text ([url](https://dequeuniversity.com/rules/axe/4.7/svg-img-alt?application=axeAPI))
|
|
404
419
|
*/
|
|
405
420
|
svgImgAlt: "svg-img-alt",
|
|
406
421
|
/**
|
|
407
422
|
* - Ensures `<video>` elements have captions
|
|
408
|
-
* - `<video>` elements must have captions ([url](https://dequeuniversity.com/rules/axe/4.
|
|
423
|
+
* - `<video>` elements must have captions ([url](https://dequeuniversity.com/rules/axe/4.7/video-caption?application=axeAPI))
|
|
409
424
|
*/
|
|
410
425
|
videoCaption: "video-caption"
|
|
411
426
|
};
|
|
412
427
|
var aria = {
|
|
413
428
|
/**
|
|
414
|
-
* - Ensures an element's role
|
|
415
|
-
* - Elements must only use
|
|
429
|
+
* - Ensures ARIA attributes are allowed for an element's role
|
|
430
|
+
* - Elements must only use allowed ARIA attributes ([url](https://dequeuniversity.com/rules/axe/4.7/aria-allowed-attr?application=axeAPI))
|
|
416
431
|
*/
|
|
417
432
|
ariaAllowedAttr: "aria-allowed-attr",
|
|
418
433
|
/**
|
|
419
434
|
* - Ensures role attribute has an appropriate value for the element
|
|
420
|
-
* - ARIA role should be appropriate for the element ([url](https://dequeuniversity.com/rules/axe/4.
|
|
435
|
+
* - ARIA role should be appropriate for the element ([url](https://dequeuniversity.com/rules/axe/4.7/aria-allowed-role?application=axeAPI))
|
|
421
436
|
*/
|
|
422
437
|
ariaAllowedRole: "aria-allowed-role",
|
|
423
|
-
/**
|
|
424
|
-
* - Ensure aria-braillelabel and aria-brailleroledescription have a non-braille equivalent
|
|
425
|
-
* - aria-braille attributes must have a non-braille equivalent ([url](https://dequeuniversity.com/rules/axe/4.8/aria-braille-equivalent?application=axeAPI))
|
|
426
|
-
*/
|
|
427
|
-
ariaBrailleEquivalent: "aria-braille-equivalent",
|
|
428
438
|
/**
|
|
429
439
|
* - Ensures every ARIA button, link and menuitem has an accessible name
|
|
430
|
-
* - ARIA commands must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
440
|
+
* - ARIA commands must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/aria-command-name?application=axeAPI))
|
|
431
441
|
*/
|
|
432
442
|
ariaCommandName: "aria-command-name",
|
|
433
|
-
/**
|
|
434
|
-
* - Ensures ARIA attributes are used as described in the specification of the element's role
|
|
435
|
-
* - 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))
|
|
436
|
-
*/
|
|
437
|
-
ariaConditionalAttr: "aria-conditional-attr",
|
|
438
|
-
/**
|
|
439
|
-
* - Ensures elements do not use deprecated roles
|
|
440
|
-
* - Deprecated ARIA roles must not be used ([url](https://dequeuniversity.com/rules/axe/4.8/aria-deprecated-role?application=axeAPI))
|
|
441
|
-
*/
|
|
442
|
-
ariaDeprecatedRole: "aria-deprecated-role",
|
|
443
443
|
/**
|
|
444
444
|
* - Ensures every ARIA dialog and alertdialog node has an accessible name
|
|
445
|
-
* - ARIA dialog and alertdialog nodes should have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
445
|
+
* - ARIA dialog and alertdialog nodes should have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/aria-dialog-name?application=axeAPI))
|
|
446
446
|
*/
|
|
447
447
|
ariaDialogName: "aria-dialog-name",
|
|
448
448
|
/**
|
|
449
|
-
* - Ensures aria-hidden=
|
|
450
|
-
* - aria-hidden=
|
|
449
|
+
* - Ensures aria-hidden='true' is not present on the document body.
|
|
450
|
+
* - aria-hidden='true' must not be present on the document body ([url](https://dequeuniversity.com/rules/axe/4.7/aria-hidden-body?application=axeAPI))
|
|
451
451
|
*/
|
|
452
452
|
ariaHiddenBody: "aria-hidden-body",
|
|
453
453
|
/**
|
|
454
454
|
* - Ensures every ARIA input field has an accessible name
|
|
455
|
-
* - ARIA input fields must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
455
|
+
* - ARIA input fields must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/aria-input-field-name?application=axeAPI))
|
|
456
456
|
*/
|
|
457
457
|
ariaInputFieldName: "aria-input-field-name",
|
|
458
458
|
/**
|
|
459
459
|
* - Ensures every ARIA meter node has an accessible name
|
|
460
|
-
* - ARIA meter nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
460
|
+
* - ARIA meter nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/aria-meter-name?application=axeAPI))
|
|
461
461
|
*/
|
|
462
462
|
ariaMeterName: "aria-meter-name",
|
|
463
463
|
/**
|
|
464
464
|
* - Ensures every ARIA progressbar node has an accessible name
|
|
465
|
-
* - ARIA progressbar nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
465
|
+
* - ARIA progressbar nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/aria-progressbar-name?application=axeAPI))
|
|
466
466
|
*/
|
|
467
467
|
ariaProgressbarName: "aria-progressbar-name",
|
|
468
|
-
/**
|
|
469
|
-
* - Ensures ARIA attributes are not prohibited for an element's role
|
|
470
|
-
* - Elements must only use permitted ARIA attributes ([url](https://dequeuniversity.com/rules/axe/4.8/aria-prohibited-attr?application=axeAPI))
|
|
471
|
-
*/
|
|
472
|
-
ariaProhibitedAttr: "aria-prohibited-attr",
|
|
473
468
|
/**
|
|
474
469
|
* - Ensures elements with ARIA roles have all required ARIA attributes
|
|
475
|
-
* - Required ARIA attributes must be provided ([url](https://dequeuniversity.com/rules/axe/4.
|
|
470
|
+
* - Required ARIA attributes must be provided ([url](https://dequeuniversity.com/rules/axe/4.7/aria-required-attr?application=axeAPI))
|
|
476
471
|
*/
|
|
477
472
|
ariaRequiredAttr: "aria-required-attr",
|
|
478
473
|
/**
|
|
479
474
|
* - Ensures elements with an ARIA role that require child roles contain them
|
|
480
|
-
* - Certain ARIA roles must contain particular children ([url](https://dequeuniversity.com/rules/axe/4.
|
|
475
|
+
* - Certain ARIA roles must contain particular children ([url](https://dequeuniversity.com/rules/axe/4.7/aria-required-children?application=axeAPI))
|
|
481
476
|
*/
|
|
482
477
|
ariaRequiredChildren: "aria-required-children",
|
|
483
478
|
/**
|
|
484
479
|
* - Ensures elements with an ARIA role that require parent roles are contained by them
|
|
485
|
-
* - Certain ARIA roles must be contained by particular parents ([url](https://dequeuniversity.com/rules/axe/4.
|
|
480
|
+
* - Certain ARIA roles must be contained by particular parents ([url](https://dequeuniversity.com/rules/axe/4.7/aria-required-parent?application=axeAPI))
|
|
486
481
|
*/
|
|
487
482
|
ariaRequiredParent: "aria-required-parent",
|
|
488
483
|
/**
|
|
489
484
|
* - Ensure aria-roledescription is only used on elements with an implicit or explicit role
|
|
490
|
-
* - aria-roledescription must be on elements with a semantic role ([url](https://dequeuniversity.com/rules/axe/4.
|
|
485
|
+
* - aria-roledescription must be on elements with a semantic role ([url](https://dequeuniversity.com/rules/axe/4.7/aria-roledescription?application=axeAPI))
|
|
491
486
|
*/
|
|
492
487
|
ariaRoledescription: "aria-roledescription",
|
|
493
488
|
/**
|
|
494
489
|
* - Ensures all elements with a role attribute use a valid value
|
|
495
|
-
* - ARIA roles used must conform to valid values ([url](https://dequeuniversity.com/rules/axe/4.
|
|
490
|
+
* - ARIA roles used must conform to valid values ([url](https://dequeuniversity.com/rules/axe/4.7/aria-roles?application=axeAPI))
|
|
496
491
|
*/
|
|
497
492
|
ariaRoles: "aria-roles",
|
|
498
493
|
/**
|
|
499
|
-
* - Ensures role=
|
|
500
|
-
* - "role=text" should have no focusable descendants ([url](https://dequeuniversity.com/rules/axe/4.
|
|
494
|
+
* - Ensures "role=text" is used on elements with no focusable descendants
|
|
495
|
+
* - "role=text" should have no focusable descendants ([url](https://dequeuniversity.com/rules/axe/4.7/aria-text?application=axeAPI))
|
|
501
496
|
*/
|
|
502
497
|
ariaText: "aria-text",
|
|
503
498
|
/**
|
|
504
499
|
* - Ensures every ARIA toggle field has an accessible name
|
|
505
|
-
* - ARIA toggle fields must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
500
|
+
* - ARIA toggle fields must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/aria-toggle-field-name?application=axeAPI))
|
|
506
501
|
*/
|
|
507
502
|
ariaToggleFieldName: "aria-toggle-field-name",
|
|
508
503
|
/**
|
|
509
504
|
* - Ensures every ARIA tooltip node has an accessible name
|
|
510
|
-
* - ARIA tooltip nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
505
|
+
* - ARIA tooltip nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/aria-tooltip-name?application=axeAPI))
|
|
511
506
|
*/
|
|
512
507
|
ariaTooltipName: "aria-tooltip-name",
|
|
513
508
|
/**
|
|
514
509
|
* - Ensures every ARIA treeitem node has an accessible name
|
|
515
|
-
* - ARIA treeitem nodes should have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
510
|
+
* - ARIA treeitem nodes should have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/aria-treeitem-name?application=axeAPI))
|
|
516
511
|
*/
|
|
517
512
|
ariaTreeitemName: "aria-treeitem-name",
|
|
518
513
|
/**
|
|
519
514
|
* - Ensures all ARIA attributes have valid values
|
|
520
|
-
* - ARIA attributes must conform to valid values ([url](https://dequeuniversity.com/rules/axe/4.
|
|
515
|
+
* - ARIA attributes must conform to valid values ([url](https://dequeuniversity.com/rules/axe/4.7/aria-valid-attr-value?application=axeAPI))
|
|
521
516
|
*/
|
|
522
517
|
ariaValidAttrValue: "aria-valid-attr-value",
|
|
523
518
|
/**
|
|
524
519
|
* - Ensures attributes that begin with aria- are valid ARIA attributes
|
|
525
|
-
* - ARIA attributes must conform to valid names ([url](https://dequeuniversity.com/rules/axe/4.
|
|
520
|
+
* - ARIA attributes must conform to valid names ([url](https://dequeuniversity.com/rules/axe/4.7/aria-valid-attr?application=axeAPI))
|
|
526
521
|
*/
|
|
527
522
|
ariaValidAttr: "aria-valid-attr",
|
|
528
523
|
/**
|
|
529
524
|
* - Elements marked as presentational should not have global ARIA or tabindex to ensure all screen readers ignore them
|
|
530
|
-
* - Ensure elements marked as presentational are consistently ignored ([url](https://dequeuniversity.com/rules/axe/4.
|
|
525
|
+
* - Ensure elements marked as presentational are consistently ignored ([url](https://dequeuniversity.com/rules/axe/4.7/presentation-role-conflict?application=axeAPI))
|
|
531
526
|
*/
|
|
532
527
|
presentationRoleConflict: "presentation-role-conflict"
|
|
533
528
|
};
|
|
534
529
|
var nameRoleValue = {
|
|
535
530
|
/**
|
|
536
531
|
* - Ensures aria-hidden elements are not focusable nor contain focusable elements
|
|
537
|
-
* - ARIA hidden element must not be focusable or contain focusable elements ([url](https://dequeuniversity.com/rules/axe/4.
|
|
532
|
+
* - ARIA hidden element must not be focusable or contain focusable elements ([url](https://dequeuniversity.com/rules/axe/4.7/aria-hidden-focus?application=axeAPI))
|
|
538
533
|
*/
|
|
539
534
|
ariaHiddenFocus: "aria-hidden-focus",
|
|
540
535
|
/**
|
|
541
536
|
* - Ensures buttons have discernible text
|
|
542
|
-
* - Buttons must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
537
|
+
* - Buttons must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.7/button-name?application=axeAPI))
|
|
543
538
|
*/
|
|
544
539
|
buttonName: "button-name",
|
|
545
540
|
/**
|
|
546
541
|
* - Ensures headings have discernible text
|
|
547
|
-
* - Headings should not be empty ([url](https://dequeuniversity.com/rules/axe/4.
|
|
542
|
+
* - Headings should not be empty ([url](https://dequeuniversity.com/rules/axe/4.7/empty-heading?application=axeAPI))
|
|
548
543
|
*/
|
|
549
544
|
emptyHeading: "empty-heading",
|
|
550
545
|
/**
|
|
551
546
|
* - Ensures table headers have discernible text
|
|
552
|
-
* - Table header text should not be empty ([url](https://dequeuniversity.com/rules/axe/4.
|
|
547
|
+
* - Table header text should not be empty ([url](https://dequeuniversity.com/rules/axe/4.7/empty-table-header?application=axeAPI))
|
|
553
548
|
*/
|
|
554
549
|
emptyTableHeader: "empty-table-header",
|
|
555
550
|
/**
|
|
556
551
|
* - Ensures input buttons have discernible text
|
|
557
|
-
* - Input buttons must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
552
|
+
* - Input buttons must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.7/input-button-name?application=axeAPI))
|
|
558
553
|
*/
|
|
559
554
|
inputButtonName: "input-button-name",
|
|
560
555
|
/**
|
|
561
556
|
* - Ensures links have discernible text
|
|
562
|
-
* - Links must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
557
|
+
* - Links must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.7/link-name?application=axeAPI))
|
|
563
558
|
*/
|
|
564
559
|
linkName: "link-name"
|
|
565
560
|
};
|
|
566
561
|
var timeAndMedia = {
|
|
567
562
|
/**
|
|
568
563
|
* - Ensures `<audio>` elements have captions
|
|
569
|
-
* - `<audio>` elements must have a captions track ([url](https://dequeuniversity.com/rules/axe/4.
|
|
564
|
+
* - `<audio>` elements must have a captions track ([url](https://dequeuniversity.com/rules/axe/4.7/audio-caption?application=axeAPI))
|
|
570
565
|
*/
|
|
571
566
|
audioCaption: "audio-caption",
|
|
572
567
|
/**
|
|
573
568
|
* - Ensures `<blink>` elements are not used
|
|
574
|
-
* - `<blink>` elements are deprecated and must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
569
|
+
* - `<blink>` elements are deprecated and must not be used ([url](https://dequeuniversity.com/rules/axe/4.7/blink?application=axeAPI))
|
|
575
570
|
*/
|
|
576
571
|
blink: "blink",
|
|
577
572
|
/**
|
|
578
573
|
* - Ensures `<meta http-equiv="refresh">` is not used for delayed refresh
|
|
579
|
-
* - Delayed refresh must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
574
|
+
* - Delayed refresh must not be used ([url](https://dequeuniversity.com/rules/axe/4.7/meta-refresh-no-exceptions?application=axeAPI))
|
|
580
575
|
*/
|
|
581
576
|
metaRefreshNoExceptions: "meta-refresh-no-exceptions",
|
|
582
577
|
/**
|
|
583
578
|
* - Ensures `<meta http-equiv="refresh">` is not used for delayed refresh
|
|
584
|
-
* - Delayed refresh under 20 hours must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
579
|
+
* - Delayed refresh under 20 hours must not be used ([url](https://dequeuniversity.com/rules/axe/4.7/meta-refresh?application=axeAPI))
|
|
585
580
|
*/
|
|
586
581
|
metaRefresh: "meta-refresh",
|
|
587
582
|
/**
|
|
588
583
|
* - Ensures `<video>` or `<audio>` elements do not autoplay audio for more than 3 seconds without a control mechanism to stop or mute the audio
|
|
589
|
-
* - `<video>` or `<audio>` elements must not play automatically ([url](https://dequeuniversity.com/rules/axe/4.
|
|
584
|
+
* - `<video>` or `<audio>` elements must not play automatically ([url](https://dequeuniversity.com/rules/axe/4.7/no-autoplay-audio?application=axeAPI))
|
|
590
585
|
*/
|
|
591
586
|
noAutoplayAudio: "no-autoplay-audio"
|
|
592
587
|
};
|
|
593
588
|
var forms = {
|
|
594
589
|
/**
|
|
595
590
|
* - Ensure the autocomplete attribute is correct and suitable for the form field
|
|
596
|
-
* - autocomplete attribute must be used correctly ([url](https://dequeuniversity.com/rules/axe/4.
|
|
591
|
+
* - autocomplete attribute must be used correctly ([url](https://dequeuniversity.com/rules/axe/4.7/autocomplete-valid?application=axeAPI))
|
|
597
592
|
*/
|
|
598
593
|
autocompleteValid: "autocomplete-valid",
|
|
599
594
|
/**
|
|
600
595
|
* - Ensures form field does not have multiple label elements
|
|
601
|
-
* - Form field must not have multiple label elements ([url](https://dequeuniversity.com/rules/axe/4.
|
|
596
|
+
* - Form field must not have multiple label elements ([url](https://dequeuniversity.com/rules/axe/4.7/form-field-multiple-labels?application=axeAPI))
|
|
602
597
|
*/
|
|
603
598
|
formFieldMultipleLabels: "form-field-multiple-labels",
|
|
604
599
|
/**
|
|
605
600
|
* - Ensures that every form element has a visible label and is not solely labeled using hidden labels, or the title or aria-describedby attributes
|
|
606
|
-
* - Form elements should have a visible label ([url](https://dequeuniversity.com/rules/axe/4.
|
|
601
|
+
* - Form elements should have a visible label ([url](https://dequeuniversity.com/rules/axe/4.7/label-title-only?application=axeAPI))
|
|
607
602
|
*/
|
|
608
603
|
labelTitleOnly: "label-title-only",
|
|
609
604
|
/**
|
|
610
605
|
* - Ensures every form element has a label
|
|
611
|
-
* - Form elements must have labels ([url](https://dequeuniversity.com/rules/axe/4.
|
|
606
|
+
* - Form elements must have labels ([url](https://dequeuniversity.com/rules/axe/4.7/label?application=axeAPI))
|
|
612
607
|
*/
|
|
613
608
|
label: "label",
|
|
614
609
|
/**
|
|
615
610
|
* - Ensures select element has an accessible name
|
|
616
|
-
* - Select element must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
611
|
+
* - Select element must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.7/select-name?application=axeAPI))
|
|
617
612
|
*/
|
|
618
613
|
selectName: "select-name"
|
|
619
614
|
};
|
|
620
615
|
var structure = {
|
|
621
616
|
/**
|
|
622
617
|
* - Ensure that text spacing set through style attributes can be adjusted with custom stylesheets
|
|
623
|
-
* - Inline text spacing must be adjustable with custom stylesheets ([url](https://dequeuniversity.com/rules/axe/4.
|
|
618
|
+
* - Inline text spacing must be adjustable with custom stylesheets ([url](https://dequeuniversity.com/rules/axe/4.7/avoid-inline-spacing?application=axeAPI))
|
|
624
619
|
*/
|
|
625
620
|
avoidInlineSpacing: "avoid-inline-spacing",
|
|
626
621
|
/**
|
|
627
622
|
* - Ensures content is not locked to any specific display orientation, and the content is operable in all display orientations
|
|
628
|
-
* - CSS Media queries must not lock display orientation ([url](https://dequeuniversity.com/rules/axe/4.
|
|
623
|
+
* - CSS Media queries must not lock display orientation ([url](https://dequeuniversity.com/rules/axe/4.7/css-orientation-lock?application=axeAPI))
|
|
629
624
|
*/
|
|
630
625
|
cssOrientationLock: "css-orientation-lock",
|
|
631
626
|
/**
|
|
632
627
|
* - Ensures `<dl>` elements are structured correctly
|
|
633
|
-
* - `<dl>` elements must only directly contain properly-ordered `<dt>` and `<dd>` groups, `<script>`, `<template>` or `<div>` elements ([url](https://dequeuniversity.com/rules/axe/4.
|
|
628
|
+
* - `<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))
|
|
634
629
|
*/
|
|
635
630
|
definitionList: "definition-list",
|
|
636
631
|
/**
|
|
637
632
|
* - Ensures `<dt>` and `<dd>` elements are contained by a `<dl>`
|
|
638
|
-
* - `<dt>` and `<dd>` elements must be contained by a `<dl>` ([url](https://dequeuniversity.com/rules/axe/4.
|
|
633
|
+
* - `<dt>` and `<dd>` elements must be contained by a `<dl>` ([url](https://dequeuniversity.com/rules/axe/4.7/dlitem?application=axeAPI))
|
|
639
634
|
*/
|
|
640
635
|
dlitem: "dlitem",
|
|
641
636
|
/**
|
|
642
637
|
* - Ensures `<iframe>` and `<frame>` elements contain the axe-core script
|
|
643
|
-
* - Frames should be tested with axe-core ([url](https://dequeuniversity.com/rules/axe/4.
|
|
638
|
+
* - Frames should be tested with axe-core ([url](https://dequeuniversity.com/rules/axe/4.7/frame-tested?application=axeAPI))
|
|
644
639
|
*/
|
|
645
640
|
frameTested: "frame-tested",
|
|
646
641
|
/**
|
|
647
642
|
* - Informs users about hidden content.
|
|
648
|
-
* - Hidden content on the page should be analyzed ([url](https://dequeuniversity.com/rules/axe/4.
|
|
643
|
+
* - Hidden content on the page should be analyzed ([url](https://dequeuniversity.com/rules/axe/4.7/hidden-content?application=axeAPI))
|
|
649
644
|
*/
|
|
650
645
|
hiddenContent: "hidden-content",
|
|
651
646
|
/**
|
|
652
647
|
* - Ensures that lists are structured correctly
|
|
653
|
-
* - `<ul>` and `<ol>` must only directly contain `<li>`, `<script>` or `<template>` elements ([url](https://dequeuniversity.com/rules/axe/4.
|
|
648
|
+
* - `<ul>` and `<ol>` must only directly contain `<li>`, `<script>` or `<template>` elements ([url](https://dequeuniversity.com/rules/axe/4.7/list?application=axeAPI))
|
|
654
649
|
*/
|
|
655
650
|
list: "list",
|
|
656
651
|
/**
|
|
657
652
|
* - Ensures `<li>` elements are used semantically
|
|
658
|
-
* - `<li>` elements must be contained in a `<ul>` or `<ol>` ([url](https://dequeuniversity.com/rules/axe/4.
|
|
653
|
+
* - `<li>` elements must be contained in a `<ul>` or `<ol>` ([url](https://dequeuniversity.com/rules/axe/4.7/listitem?application=axeAPI))
|
|
659
654
|
*/
|
|
660
655
|
listitem: "listitem"
|
|
661
656
|
};
|
|
662
657
|
var parsing = {
|
|
663
658
|
/**
|
|
664
659
|
* - Ensures every id attribute value of active elements is unique
|
|
665
|
-
* - IDs of active elements must be unique ([url](https://dequeuniversity.com/rules/axe/4.
|
|
660
|
+
* - IDs of active elements must be unique ([url](https://dequeuniversity.com/rules/axe/4.7/duplicate-id-active?application=axeAPI))
|
|
666
661
|
*/
|
|
667
662
|
duplicateIdActive: "duplicate-id-active",
|
|
668
663
|
/**
|
|
669
664
|
* - Ensures every id attribute value used in ARIA and in labels is unique
|
|
670
|
-
* - IDs used in ARIA and labels must be unique ([url](https://dequeuniversity.com/rules/axe/4.
|
|
665
|
+
* - IDs used in ARIA and labels must be unique ([url](https://dequeuniversity.com/rules/axe/4.7/duplicate-id-aria?application=axeAPI))
|
|
671
666
|
*/
|
|
672
667
|
duplicateIdAria: "duplicate-id-aria",
|
|
673
668
|
/**
|
|
674
669
|
* - Ensures every id attribute value is unique
|
|
675
|
-
* - id attribute value must be unique ([url](https://dequeuniversity.com/rules/axe/4.
|
|
670
|
+
* - id attribute value must be unique ([url](https://dequeuniversity.com/rules/axe/4.7/duplicate-id?application=axeAPI))
|
|
676
671
|
*/
|
|
677
672
|
duplicateId: "duplicate-id",
|
|
678
673
|
/**
|
|
679
674
|
* - Ensures `<marquee>` elements are not used
|
|
680
|
-
* - `<marquee>` elements are deprecated and must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
675
|
+
* - `<marquee>` elements are deprecated and must not be used ([url](https://dequeuniversity.com/rules/axe/4.7/marquee?application=axeAPI))
|
|
681
676
|
*/
|
|
682
677
|
marquee: "marquee"
|
|
683
678
|
};
|
|
684
679
|
var semantics = {
|
|
685
680
|
/**
|
|
686
681
|
* - Ensures the order of headings is semantically correct
|
|
687
|
-
* - Heading levels should only increase by one ([url](https://dequeuniversity.com/rules/axe/4.
|
|
682
|
+
* - Heading levels should only increase by one ([url](https://dequeuniversity.com/rules/axe/4.7/heading-order?application=axeAPI))
|
|
688
683
|
*/
|
|
689
684
|
headingOrder: "heading-order",
|
|
690
685
|
/**
|
|
691
686
|
* - Ensure that links with the same accessible name serve a similar purpose
|
|
692
|
-
* - Links with the same name must have a similar purpose ([url](https://dequeuniversity.com/rules/axe/4.
|
|
687
|
+
* - Links with the same name must have a similar purpose ([url](https://dequeuniversity.com/rules/axe/4.7/identical-links-same-purpose?application=axeAPI))
|
|
693
688
|
*/
|
|
694
689
|
identicalLinksSamePurpose: "identical-links-same-purpose",
|
|
695
690
|
/**
|
|
696
691
|
* - Ensures that elements labelled through their content must have their visible text as part of their accessible name
|
|
697
|
-
* - Elements must have their visible text as part of their accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
692
|
+
* - 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))
|
|
698
693
|
*/
|
|
699
694
|
labelContentNameMismatch: "label-content-name-mismatch",
|
|
700
695
|
/**
|
|
701
696
|
* - Ensures the banner landmark is at top level
|
|
702
|
-
* - Banner landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
697
|
+
* - Banner landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.7/landmark-banner-is-top-level?application=axeAPI))
|
|
703
698
|
*/
|
|
704
699
|
landmarkBannerIsTopLevel: "landmark-banner-is-top-level",
|
|
705
700
|
/**
|
|
706
701
|
* - Ensures the complementary landmark or aside is at top level
|
|
707
|
-
* - Aside should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
702
|
+
* - Aside should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.7/landmark-complementary-is-top-level?application=axeAPI))
|
|
708
703
|
*/
|
|
709
704
|
landmarkComplementaryIsTopLevel: "landmark-complementary-is-top-level",
|
|
710
705
|
/**
|
|
711
706
|
* - Ensures the contentinfo landmark is at top level
|
|
712
|
-
* - Contentinfo landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
707
|
+
* - Contentinfo landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.7/landmark-contentinfo-is-top-level?application=axeAPI))
|
|
713
708
|
*/
|
|
714
709
|
landmarkContentinfoIsTopLevel: "landmark-contentinfo-is-top-level",
|
|
715
710
|
/**
|
|
716
711
|
* - Ensures the main landmark is at top level
|
|
717
|
-
* - Main landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
712
|
+
* - Main landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.7/landmark-main-is-top-level?application=axeAPI))
|
|
718
713
|
*/
|
|
719
714
|
landmarkMainIsTopLevel: "landmark-main-is-top-level",
|
|
720
715
|
/**
|
|
721
716
|
* - Ensures the document has at most one banner landmark
|
|
722
|
-
* - Document should not have more than one banner landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
717
|
+
* - Document should not have more than one banner landmark ([url](https://dequeuniversity.com/rules/axe/4.7/landmark-no-duplicate-banner?application=axeAPI))
|
|
723
718
|
*/
|
|
724
719
|
landmarkNoDuplicateBanner: "landmark-no-duplicate-banner",
|
|
725
720
|
/**
|
|
726
721
|
* - Ensures the document has at most one contentinfo landmark
|
|
727
|
-
* - Document should not have more than one contentinfo landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
722
|
+
* - Document should not have more than one contentinfo landmark ([url](https://dequeuniversity.com/rules/axe/4.7/landmark-no-duplicate-contentinfo?application=axeAPI))
|
|
728
723
|
*/
|
|
729
724
|
landmarkNoDuplicateContentinfo: "landmark-no-duplicate-contentinfo",
|
|
730
725
|
/**
|
|
731
726
|
* - Ensures the document has at most one main landmark
|
|
732
|
-
* - Document should not have more than one main landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
727
|
+
* - Document should not have more than one main landmark ([url](https://dequeuniversity.com/rules/axe/4.7/landmark-no-duplicate-main?application=axeAPI))
|
|
733
728
|
*/
|
|
734
729
|
landmarkNoDuplicateMain: "landmark-no-duplicate-main",
|
|
735
730
|
/**
|
|
736
731
|
* - Ensures the document has a main landmark
|
|
737
|
-
* - Document should have one main landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
732
|
+
* - Document should have one main landmark ([url](https://dequeuniversity.com/rules/axe/4.7/landmark-one-main?application=axeAPI))
|
|
738
733
|
*/
|
|
739
734
|
landmarkOneMain: "landmark-one-main",
|
|
740
735
|
/**
|
|
741
736
|
* - Landmarks should have a unique role or role/label/title (i.e. accessible name) combination
|
|
742
|
-
* - Ensures landmarks are unique ([url](https://dequeuniversity.com/rules/axe/4.
|
|
737
|
+
* - Ensures landmarks are unique ([url](https://dequeuniversity.com/rules/axe/4.7/landmark-unique?application=axeAPI))
|
|
743
738
|
*/
|
|
744
739
|
landmarkUnique: "landmark-unique",
|
|
745
740
|
/**
|
|
746
741
|
* - Ensure bold, italic text and font-size is not used to style `<p>` elements as a heading
|
|
747
|
-
* - Styled `<p>` elements must not be used as headings ([url](https://dequeuniversity.com/rules/axe/4.
|
|
742
|
+
* - Styled `<p>` elements must not be used as headings ([url](https://dequeuniversity.com/rules/axe/4.7/p-as-heading?application=axeAPI))
|
|
748
743
|
*/
|
|
749
744
|
pAsHeading: "p-as-heading",
|
|
750
745
|
/**
|
|
751
746
|
* - Ensure that the page, or at least one of its frames contains a level-one heading
|
|
752
|
-
* - Page should contain a level-one heading ([url](https://dequeuniversity.com/rules/axe/4.
|
|
747
|
+
* - Page should contain a level-one heading ([url](https://dequeuniversity.com/rules/axe/4.7/page-has-heading-one?application=axeAPI))
|
|
753
748
|
*/
|
|
754
749
|
pageHasHeadingOne: "page-has-heading-one"
|
|
755
750
|
};
|
|
756
751
|
var language = {
|
|
757
752
|
/**
|
|
758
753
|
* - Ensures every HTML document has a lang attribute
|
|
759
|
-
* - `<html>` element must have a lang attribute ([url](https://dequeuniversity.com/rules/axe/4.
|
|
754
|
+
* - `<html>` element must have a lang attribute ([url](https://dequeuniversity.com/rules/axe/4.7/html-has-lang?application=axeAPI))
|
|
760
755
|
*/
|
|
761
756
|
htmlHasLang: "html-has-lang",
|
|
762
757
|
/**
|
|
763
758
|
* - Ensures the lang attribute of the `<html>` element has a valid value
|
|
764
|
-
* - `<html>` element must have a valid value for the lang attribute ([url](https://dequeuniversity.com/rules/axe/4.
|
|
759
|
+
* - `<html>` element must have a valid value for the lang attribute ([url](https://dequeuniversity.com/rules/axe/4.7/html-lang-valid?application=axeAPI))
|
|
765
760
|
*/
|
|
766
761
|
htmlLangValid: "html-lang-valid",
|
|
767
762
|
/**
|
|
768
763
|
* - Ensure that HTML elements with both valid lang and xml:lang attributes agree on the base language of the page
|
|
769
|
-
* - HTML elements with lang and xml:lang must have the same base language ([url](https://dequeuniversity.com/rules/axe/4.
|
|
764
|
+
* - 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))
|
|
770
765
|
*/
|
|
771
766
|
htmlXmlLangMismatch: "html-xml-lang-mismatch",
|
|
772
767
|
/**
|
|
773
768
|
* - Ensures lang attributes have valid values
|
|
774
|
-
* - lang attribute must have a valid value ([url](https://dequeuniversity.com/rules/axe/4.
|
|
769
|
+
* - lang attribute must have a valid value ([url](https://dequeuniversity.com/rules/axe/4.7/valid-lang?application=axeAPI))
|
|
775
770
|
*/
|
|
776
771
|
validLang: "valid-lang"
|
|
777
772
|
};
|
|
778
773
|
var sensoryAndVisualCues = {
|
|
779
774
|
/**
|
|
780
775
|
* - Ensures `<meta name="viewport">` can scale a significant amount
|
|
781
|
-
* - Users should be able to zoom and scale the text up to 500% ([url](https://dequeuniversity.com/rules/axe/4.
|
|
776
|
+
* - 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))
|
|
782
777
|
*/
|
|
783
778
|
metaViewportLarge: "meta-viewport-large",
|
|
784
779
|
/**
|
|
785
780
|
* - Ensures `<meta name="viewport">` does not disable text scaling and zooming
|
|
786
|
-
* - Zooming and scaling must not be disabled ([url](https://dequeuniversity.com/rules/axe/4.
|
|
781
|
+
* - Zooming and scaling must not be disabled ([url](https://dequeuniversity.com/rules/axe/4.7/meta-viewport?application=axeAPI))
|
|
787
782
|
*/
|
|
788
783
|
metaViewport: "meta-viewport",
|
|
789
784
|
/**
|
|
790
785
|
* - Ensure touch target have sufficient size and space
|
|
791
|
-
* - All touch targets must be 24px large, or leave sufficient space ([url](https://dequeuniversity.com/rules/axe/4.
|
|
786
|
+
* - All touch targets must be 24px large, or leave sufficient space ([url](https://dequeuniversity.com/rules/axe/4.7/target-size?application=axeAPI))
|
|
792
787
|
*/
|
|
793
788
|
targetSize: "target-size"
|
|
794
789
|
};
|
|
795
790
|
var tables = {
|
|
796
791
|
/**
|
|
797
792
|
* - Ensures the scope attribute is used correctly on tables
|
|
798
|
-
* - scope attribute should be used correctly ([url](https://dequeuniversity.com/rules/axe/4.
|
|
793
|
+
* - scope attribute should be used correctly ([url](https://dequeuniversity.com/rules/axe/4.7/scope-attr-valid?application=axeAPI))
|
|
799
794
|
*/
|
|
800
795
|
scopeAttrValid: "scope-attr-valid",
|
|
801
796
|
/**
|
|
802
797
|
* - Ensure the `<caption>` element does not contain the same text as the summary attribute
|
|
803
|
-
* - tables should not have the same summary and caption ([url](https://dequeuniversity.com/rules/axe/4.
|
|
798
|
+
* - tables should not have the same summary and caption ([url](https://dequeuniversity.com/rules/axe/4.7/table-duplicate-name?application=axeAPI))
|
|
804
799
|
*/
|
|
805
800
|
tableDuplicateName: "table-duplicate-name",
|
|
806
801
|
/**
|
|
807
802
|
* - Ensure that tables with a caption use the `<caption>` element.
|
|
808
|
-
* - Data or header cells must not be used to give caption to a data table. ([url](https://dequeuniversity.com/rules/axe/4.
|
|
803
|
+
* - 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))
|
|
809
804
|
*/
|
|
810
805
|
tableFakeCaption: "table-fake-caption",
|
|
811
806
|
/**
|
|
812
807
|
* - Ensure that each non-empty data cell in a `<table>` larger than 3 by 3 has one or more table headers
|
|
813
|
-
* - Non-empty `<td>` elements in larger `<table>` must have an associated table header ([url](https://dequeuniversity.com/rules/axe/4.
|
|
808
|
+
* - 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))
|
|
814
809
|
*/
|
|
815
810
|
tdHasHeader: "td-has-header",
|
|
816
811
|
/**
|
|
817
812
|
* - Ensure that each cell in a table that uses the headers attribute refers only to other cells in that table
|
|
818
|
-
* - Table cells that use the headers attribute must only refer to cells in the same table ([url](https://dequeuniversity.com/rules/axe/4.
|
|
813
|
+
* - 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))
|
|
819
814
|
*/
|
|
820
815
|
tdHeadersAttr: "td-headers-attr",
|
|
821
816
|
/**
|
|
822
817
|
* - Ensure that `<th>` elements and elements with role=columnheader/rowheader have data cells they describe
|
|
823
|
-
* - Table headers in a data table must refer to data cells ([url](https://dequeuniversity.com/rules/axe/4.
|
|
818
|
+
* - 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))
|
|
824
819
|
*/
|
|
825
820
|
thHasDataCells: "th-has-data-cells"
|
|
826
821
|
};
|
|
827
822
|
|
|
828
|
-
// src/service/html/axe-rules/
|
|
829
|
-
var
|
|
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
|
-
],
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
keyboard.frameFocusableContent,
|
|
899
|
-
keyboard.skipLink,
|
|
900
|
-
nameRoleValue.ariaHiddenFocus,
|
|
901
|
-
semantics.labelContentNameMismatch,
|
|
902
|
-
structure.definitionList,
|
|
903
|
-
structure.list,
|
|
904
|
-
tables.tableDuplicateName,
|
|
905
|
-
tables.tableFakeCaption,
|
|
906
|
-
tables.thHasDataCells,
|
|
907
|
-
textAlternatives.documentTitle,
|
|
908
|
-
textAlternatives.frameTitleUnique,
|
|
909
|
-
textAlternatives.frameTitle,
|
|
910
|
-
textAlternatives.videoCaption
|
|
911
|
-
],
|
|
912
|
-
/**
|
|
913
|
-
* These rules can be resolved by changing content in
|
|
914
|
-
* either the node body or its attributes
|
|
915
|
-
*/
|
|
916
|
-
requiresAttrsOrChildren: [
|
|
917
|
-
aria.ariaCommandName,
|
|
918
|
-
aria.ariaDialogName,
|
|
919
|
-
aria.ariaInputFieldName,
|
|
920
|
-
aria.ariaMeterName,
|
|
921
|
-
aria.ariaProgressbarName,
|
|
922
|
-
aria.ariaToggleFieldName,
|
|
923
|
-
aria.ariaTooltipName,
|
|
924
|
-
aria.ariaTreeitemName,
|
|
925
|
-
nameRoleValue.inputButtonName,
|
|
926
|
-
nameRoleValue.linkName
|
|
927
|
-
],
|
|
928
|
-
/**
|
|
929
|
-
* These rules cannot be supported until multiple files
|
|
930
|
-
* are analyzed at once. For now they are ignored.
|
|
931
|
-
*/
|
|
932
|
-
requiresParent: [
|
|
933
|
-
aria.ariaRequiredParent,
|
|
934
|
-
forms.label,
|
|
935
|
-
forms.labelTitleOnly,
|
|
936
|
-
forms.selectName,
|
|
937
|
-
keyboard.bypass,
|
|
938
|
-
keyboard.nestedInteractive,
|
|
939
|
-
keyboard.region,
|
|
940
|
-
semantics.headingOrder,
|
|
941
|
-
semantics.landmarkBannerIsTopLevel,
|
|
942
|
-
semantics.landmarkComplementaryIsTopLevel,
|
|
943
|
-
semantics.landmarkContentinfoIsTopLevel,
|
|
944
|
-
semantics.landmarkMainIsTopLevel,
|
|
945
|
-
semantics.landmarkOneMain,
|
|
946
|
-
semantics.pageHasHeadingOne,
|
|
947
|
-
structure.dlitem,
|
|
948
|
-
structure.listitem,
|
|
949
|
-
tables.tdHasHeader,
|
|
950
|
-
tables.tdHeadersAttr
|
|
951
|
-
],
|
|
952
|
-
/**
|
|
953
|
-
* These rules should not be enforced to all users of
|
|
954
|
-
* the official Marko language server.
|
|
955
|
-
*/
|
|
956
|
-
blacklist: [structure.frameTested],
|
|
957
|
-
/**
|
|
958
|
-
* These are rules that cannot currently be validated, either
|
|
959
|
-
* because of limitations with JSDom + axe-core or with the
|
|
960
|
-
* current implementation of the language server.
|
|
961
|
-
*/
|
|
962
|
-
cannotValidate: [
|
|
963
|
-
parsing.duplicateIdAria,
|
|
964
|
-
keyboard.scrollableRegionFocusable,
|
|
965
|
-
semantics.pAsHeading,
|
|
966
|
-
structure.avoidInlineSpacing,
|
|
967
|
-
structure.cssOrientationLock,
|
|
968
|
-
structure.hiddenContent,
|
|
969
|
-
sensoryAndVisualCues.targetSize
|
|
970
|
-
]
|
|
823
|
+
// src/service/html/axe-rules/rule-exceptions.ts
|
|
824
|
+
var ruleExceptions = {
|
|
825
|
+
[aria.ariaAllowedAttr]: {},
|
|
826
|
+
[aria.ariaAllowedRole]: { dynamicAttrs: ["role"] },
|
|
827
|
+
[aria.ariaCommandName]: { unknownBody: true, attrSpread: true },
|
|
828
|
+
[aria.ariaDialogName]: { unknownBody: true, attrSpread: true },
|
|
829
|
+
[aria.ariaHiddenBody]: {},
|
|
830
|
+
[aria.ariaInputFieldName]: { unknownBody: true, attrSpread: true },
|
|
831
|
+
[aria.ariaMeterName]: { unknownBody: true, attrSpread: true },
|
|
832
|
+
[aria.ariaProgressbarName]: { unknownBody: true, attrSpread: true },
|
|
833
|
+
[aria.ariaRequiredAttr]: { attrSpread: true },
|
|
834
|
+
[aria.ariaRequiredChildren]: { unknownBody: true },
|
|
835
|
+
[aria.ariaRoles]: {},
|
|
836
|
+
[aria.ariaText]: { unknownBody: true },
|
|
837
|
+
[aria.ariaToggleFieldName]: { unknownBody: true, attrSpread: true },
|
|
838
|
+
[aria.ariaTooltipName]: { unknownBody: true, attrSpread: true },
|
|
839
|
+
[aria.ariaTreeitemName]: { unknownBody: true, attrSpread: true },
|
|
840
|
+
[aria.presentationRoleConflict]: {},
|
|
841
|
+
[forms.autocompleteValid]: {},
|
|
842
|
+
[forms.formFieldMultipleLabels]: {},
|
|
843
|
+
[keyboard.accesskeys]: {},
|
|
844
|
+
[keyboard.focusOrderSemantics]: {},
|
|
845
|
+
[keyboard.frameFocusableContent]: { unknownBody: true },
|
|
846
|
+
[keyboard.skipLink]: { unknownBody: true },
|
|
847
|
+
[keyboard.tabindex]: {},
|
|
848
|
+
[language.htmlHasLang]: { attrSpread: true },
|
|
849
|
+
[language.htmlLangValid]: { dynamicAttrs: ["lang"] },
|
|
850
|
+
[language.htmlXmlLangMismatch]: {},
|
|
851
|
+
[language.validLang]: { dynamicAttrs: ["lang"] },
|
|
852
|
+
[nameRoleValue.ariaHiddenFocus]: { unknownBody: true },
|
|
853
|
+
[nameRoleValue.buttonName]: { unknownBody: true, attrSpread: true },
|
|
854
|
+
[nameRoleValue.emptyHeading]: {},
|
|
855
|
+
[nameRoleValue.emptyTableHeader]: { unknownBody: true },
|
|
856
|
+
[nameRoleValue.inputButtonName]: {
|
|
857
|
+
unknownBody: true,
|
|
858
|
+
attrSpread: true
|
|
859
|
+
},
|
|
860
|
+
[nameRoleValue.linkName]: { unknownBody: true, attrSpread: true },
|
|
861
|
+
[parsing.marquee]: {},
|
|
862
|
+
[semantics.identicalLinksSamePurpose]: {},
|
|
863
|
+
[semantics.labelContentNameMismatch]: { unknownBody: true },
|
|
864
|
+
[semantics.landmarkNoDuplicateBanner]: {},
|
|
865
|
+
[semantics.landmarkNoDuplicateContentinfo]: {},
|
|
866
|
+
[semantics.landmarkNoDuplicateMain]: {},
|
|
867
|
+
[semantics.landmarkUnique]: {},
|
|
868
|
+
[sensoryAndVisualCues.metaViewport]: {},
|
|
869
|
+
[sensoryAndVisualCues.metaViewportLarge]: {},
|
|
870
|
+
[structure.definitionList]: { unknownBody: true },
|
|
871
|
+
[structure.list]: { unknownBody: true },
|
|
872
|
+
[tables.scopeAttrValid]: {},
|
|
873
|
+
[tables.tableDuplicateName]: { unknownBody: true },
|
|
874
|
+
[tables.tableFakeCaption]: { unknownBody: true },
|
|
875
|
+
[tables.thHasDataCells]: { unknownBody: true },
|
|
876
|
+
[textAlternatives.areaAlt]: { attrSpread: true },
|
|
877
|
+
[textAlternatives.documentTitle]: { unknownBody: true },
|
|
878
|
+
[textAlternatives.frameTitle]: { unknownBody: true },
|
|
879
|
+
[textAlternatives.frameTitleUnique]: { unknownBody: true },
|
|
880
|
+
[textAlternatives.imageAlt]: { attrSpread: true },
|
|
881
|
+
[textAlternatives.imageRedundantAlt]: { attrSpread: true },
|
|
882
|
+
[textAlternatives.inputImageAlt]: { attrSpread: true },
|
|
883
|
+
[textAlternatives.objectAlt]: { attrSpread: true },
|
|
884
|
+
[textAlternatives.roleImgAlt]: { attrSpread: true },
|
|
885
|
+
[textAlternatives.serverSideImageMap]: {},
|
|
886
|
+
[textAlternatives.svgImgAlt]: { attrSpread: true },
|
|
887
|
+
[textAlternatives.videoCaption]: { unknownBody: true },
|
|
888
|
+
[timeAndMedia.audioCaption]: { unknownBody: true },
|
|
889
|
+
[timeAndMedia.blink]: {},
|
|
890
|
+
[timeAndMedia.metaRefresh]: {},
|
|
891
|
+
[timeAndMedia.metaRefreshNoExceptions]: {},
|
|
892
|
+
[timeAndMedia.noAutoplayAudio]: {}
|
|
971
893
|
};
|
|
972
|
-
var separated_rules_default = rules;
|
|
973
894
|
|
|
974
895
|
// src/service/html/index.ts
|
|
975
896
|
var extractCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -1003,32 +924,22 @@ var HTMLService = {
|
|
|
1003
924
|
({ nodes, id }) => nodes.map((node) => ({ ...node, ruleId: id }))
|
|
1004
925
|
);
|
|
1005
926
|
const release = await acquireMutexLock();
|
|
1006
|
-
const violations = await getViolationNodes(
|
|
1007
|
-
const requiresAttrs = await getViolationNodes(separated_rules_default.requiresAttrs);
|
|
1008
|
-
const requiresChildren = await getViolationNodes(separated_rules_default.requiresChildren);
|
|
1009
|
-
const requiresAttrsOrChildren = await getViolationNodes(
|
|
1010
|
-
separated_rules_default.requiresAttrsOrChildren
|
|
1011
|
-
);
|
|
927
|
+
const violations = await getViolationNodes(Object.keys(ruleExceptions));
|
|
1012
928
|
release();
|
|
1013
|
-
violations.push(
|
|
1014
|
-
...requiresAttrs.filter(
|
|
1015
|
-
({ element }) => (element == null ? void 0 : element.dataset.markoNodeId) && !nodeDetails[element.dataset.markoNodeId].hasDynamicAttrs
|
|
1016
|
-
)
|
|
1017
|
-
);
|
|
1018
|
-
violations.push(
|
|
1019
|
-
...requiresChildren.filter(
|
|
1020
|
-
({ element }) => (element == null ? void 0 : element.dataset.markoNodeId) && !nodeDetails[element.dataset.markoNodeId].hasDynamicBody
|
|
1021
|
-
)
|
|
1022
|
-
);
|
|
1023
|
-
violations.push(
|
|
1024
|
-
...requiresAttrsOrChildren.filter(
|
|
1025
|
-
({ element }) => (element == null ? void 0 : element.dataset.markoNodeId) && !nodeDetails[element.dataset.markoNodeId].hasDynamicAttrs && !nodeDetails[element.dataset.markoNodeId].hasDynamicBody
|
|
1026
|
-
)
|
|
1027
|
-
);
|
|
1028
929
|
return violations.flatMap((result) => {
|
|
930
|
+
var _a;
|
|
1029
931
|
const { element } = result;
|
|
1030
932
|
if (!element)
|
|
1031
933
|
return [];
|
|
934
|
+
const ruleId = result.ruleId;
|
|
935
|
+
if (element.dataset.markoNodeId) {
|
|
936
|
+
const details = nodeDetails[element.dataset.markoNodeId];
|
|
937
|
+
if (ruleExceptions[ruleId].attrSpread && details.hasDynamicAttrs || ruleExceptions[ruleId].unknownBody && details.hasDynamicBody || ((_a = ruleExceptions[ruleId].dynamicAttrs) == null ? void 0 : _a.some(
|
|
938
|
+
(attr) => element.getAttribute(attr) === "dynamic"
|
|
939
|
+
))) {
|
|
940
|
+
return [];
|
|
941
|
+
}
|
|
942
|
+
}
|
|
1032
943
|
const generatedLoc = jsdom.nodeLocation(element);
|
|
1033
944
|
if (!generatedLoc)
|
|
1034
945
|
return [];
|
|
@@ -1042,7 +953,7 @@ var HTMLService = {
|
|
|
1042
953
|
{
|
|
1043
954
|
range: sourceRange,
|
|
1044
955
|
severity: 3,
|
|
1045
|
-
source: `axe-core(${
|
|
956
|
+
source: `axe-core(${ruleId})`,
|
|
1046
957
|
message: result.failureSummary ?? "unknown accessibility issue"
|
|
1047
958
|
}
|
|
1048
959
|
];
|
|
@@ -1053,7 +964,7 @@ function extract(doc) {
|
|
|
1053
964
|
const { parsed } = getMarkoFile(doc);
|
|
1054
965
|
let cached = extractCache.get(parsed);
|
|
1055
966
|
if (!cached) {
|
|
1056
|
-
cached = (0,
|
|
967
|
+
cached = (0, import_language_tools3.extractHTML)(parsed);
|
|
1057
968
|
extractCache.set(parsed, cached);
|
|
1058
969
|
}
|
|
1059
970
|
return cached;
|
|
@@ -1069,7 +980,7 @@ async function acquireMutexLock() {
|
|
|
1069
980
|
var html_default = HTMLService;
|
|
1070
981
|
|
|
1071
982
|
// src/service/marko/complete/index.ts
|
|
1072
|
-
var
|
|
983
|
+
var import_language_tools7 = require("@marko/language-tools");
|
|
1073
984
|
|
|
1074
985
|
// src/service/marko/complete/AttrName.ts
|
|
1075
986
|
var import_vscode_languageserver2 = require("vscode-languageserver");
|
|
@@ -1173,11 +1084,11 @@ function isExternalModule(file) {
|
|
|
1173
1084
|
}
|
|
1174
1085
|
|
|
1175
1086
|
// src/service/marko/complete/AttrValue.ts
|
|
1176
|
-
var
|
|
1087
|
+
var import_path3 = __toESM(require("path"));
|
|
1177
1088
|
var import_vscode_languageserver3 = require("vscode-languageserver");
|
|
1178
1089
|
|
|
1179
1090
|
// src/service/marko/util/is-document-link-attr.ts
|
|
1180
|
-
var
|
|
1091
|
+
var import_language_tools4 = require("@marko/language-tools");
|
|
1181
1092
|
var linkedAttrs = /* @__PURE__ */ new Map([
|
|
1182
1093
|
[
|
|
1183
1094
|
"src",
|
|
@@ -1199,7 +1110,7 @@ var linkedAttrs = /* @__PURE__ */ new Map([
|
|
|
1199
1110
|
]);
|
|
1200
1111
|
function isDocumentLinkAttr(code, tag, attr) {
|
|
1201
1112
|
var _a, _b;
|
|
1202
|
-
return tag.nameText && attr.type ===
|
|
1113
|
+
return tag.nameText && attr.type === import_language_tools4.NodeType.AttrNamed && ((_a = attr.value) == null ? void 0 : _a.type) === import_language_tools4.NodeType.AttrValue && /^['"]$/.test(code[attr.value.value.start]) && ((_b = linkedAttrs.get(code.slice(attr.name.start, attr.name.end))) == null ? void 0 : _b.has(tag.nameText)) || false;
|
|
1203
1114
|
}
|
|
1204
1115
|
|
|
1205
1116
|
// src/utils/file-system.ts
|
|
@@ -1283,7 +1194,7 @@ async function AttrValue({
|
|
|
1283
1194
|
const resolved = resolveUrl(req, uri);
|
|
1284
1195
|
if (resolved) {
|
|
1285
1196
|
const result = [];
|
|
1286
|
-
const curFile = req === "." ?
|
|
1197
|
+
const curFile = req === "." ? import_path3.default.basename(uri) : void 0;
|
|
1287
1198
|
const replaceRange = parsed.locationAt({
|
|
1288
1199
|
start: start + segmentStart + 1,
|
|
1289
1200
|
end: start + rawValue.length
|
|
@@ -1316,7 +1227,7 @@ async function AttrValue({
|
|
|
1316
1227
|
var import_vscode_languageserver5 = require("vscode-languageserver");
|
|
1317
1228
|
|
|
1318
1229
|
// src/service/marko/util/get-tag-name-completion.ts
|
|
1319
|
-
var
|
|
1230
|
+
var import_path4 = __toESM(require("path"));
|
|
1320
1231
|
var import_vscode_languageserver4 = require("vscode-languageserver");
|
|
1321
1232
|
var import_vscode_uri3 = require("vscode-uri");
|
|
1322
1233
|
var deprecated = [import_vscode_languageserver4.CompletionItemTag.Deprecated];
|
|
@@ -1339,7 +1250,7 @@ function getTagNameCompletion({
|
|
|
1339
1250
|
kind: import_vscode_languageserver4.MarkupKind.Markdown,
|
|
1340
1251
|
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:
|
|
1341
1252
|
|
|
1342
|
-
[${importer ?
|
|
1253
|
+
[${importer ? import_path4.default.relative(importer, fileForTag) : fileForTag}](${fileURIForTag})`
|
|
1343
1254
|
};
|
|
1344
1255
|
if (tag.description) {
|
|
1345
1256
|
documentation.value += `
|
|
@@ -1405,7 +1316,7 @@ function Import({
|
|
|
1405
1316
|
}
|
|
1406
1317
|
|
|
1407
1318
|
// src/service/marko/complete/OpenTagName.ts
|
|
1408
|
-
var
|
|
1319
|
+
var import_language_tools5 = require("@marko/language-tools");
|
|
1409
1320
|
function OpenTagName({
|
|
1410
1321
|
node,
|
|
1411
1322
|
file: { parsed, filename, lookup }
|
|
@@ -1413,11 +1324,11 @@ function OpenTagName({
|
|
|
1413
1324
|
var _a;
|
|
1414
1325
|
const tag = node.parent;
|
|
1415
1326
|
const range = parsed.locationAt(node);
|
|
1416
|
-
const isAttrTag = tag.type ===
|
|
1327
|
+
const isAttrTag = tag.type === import_language_tools5.NodeType.AttrTag;
|
|
1417
1328
|
const result = [];
|
|
1418
1329
|
if (isAttrTag) {
|
|
1419
1330
|
let parentTag = tag.owner;
|
|
1420
|
-
while ((parentTag == null ? void 0 : parentTag.type) ===
|
|
1331
|
+
while ((parentTag == null ? void 0 : parentTag.type) === import_language_tools5.NodeType.AttrTag)
|
|
1421
1332
|
parentTag = parentTag.owner;
|
|
1422
1333
|
const parentTagDef = parentTag && parentTag.nameText && lookup.getTag(parentTag.nameText);
|
|
1423
1334
|
if (parentTagDef) {
|
|
@@ -1437,7 +1348,7 @@ function OpenTagName({
|
|
|
1437
1348
|
}
|
|
1438
1349
|
}
|
|
1439
1350
|
} else {
|
|
1440
|
-
const skipStatements = !(tag.concise && tag.parent.type ===
|
|
1351
|
+
const skipStatements = !(tag.concise && tag.parent.type === import_language_tools5.NodeType.Program);
|
|
1441
1352
|
for (const tag2 of lookup.getTagsSorted()) {
|
|
1442
1353
|
if (!(tag2.name === "*" || tag2.isNestedTag || skipStatements && ((_a = tag2.parseOptions) == null ? void 0 : _a.statement) || tag2.name[0] === "_" && /^@?marko[/-]|[\\/]node_modules[\\/]/.test(tag2.filePath))) {
|
|
1443
1354
|
const completion = getTagNameCompletion({
|
|
@@ -1456,14 +1367,14 @@ function OpenTagName({
|
|
|
1456
1367
|
|
|
1457
1368
|
// src/service/marko/complete/Tag.ts
|
|
1458
1369
|
var import_vscode_languageserver6 = require("vscode-languageserver");
|
|
1459
|
-
var
|
|
1370
|
+
var import_language_tools6 = require("@marko/language-tools");
|
|
1460
1371
|
var partialCloseTagReg = /<\/(?:[^><]*>)?/iy;
|
|
1461
1372
|
function Tag({
|
|
1462
1373
|
node,
|
|
1463
1374
|
offset,
|
|
1464
1375
|
file: { parsed, code }
|
|
1465
1376
|
}) {
|
|
1466
|
-
const isClosed = node.end !==
|
|
1377
|
+
const isClosed = node.end !== import_language_tools6.UNFINISHED;
|
|
1467
1378
|
if (isClosed || node.concise)
|
|
1468
1379
|
return;
|
|
1469
1380
|
const closingTagStr = `</${node.nameText || ""}>`;
|
|
@@ -1514,7 +1425,7 @@ var doComplete = async (doc, params) => {
|
|
|
1514
1425
|
const offset = doc.offsetAt(params.position);
|
|
1515
1426
|
const node = file.parsed.nodeAt(offset);
|
|
1516
1427
|
return {
|
|
1517
|
-
items: await ((_a = handlers[
|
|
1428
|
+
items: await ((_a = handlers[import_language_tools7.NodeType[node.type]]) == null ? void 0 : _a.call(handlers, {
|
|
1518
1429
|
file,
|
|
1519
1430
|
params,
|
|
1520
1431
|
offset,
|
|
@@ -1525,8 +1436,8 @@ var doComplete = async (doc, params) => {
|
|
|
1525
1436
|
};
|
|
1526
1437
|
|
|
1527
1438
|
// src/service/marko/validate.ts
|
|
1528
|
-
var
|
|
1529
|
-
var
|
|
1439
|
+
var import_path5 = __toESM(require("path"));
|
|
1440
|
+
var import_language_tools8 = require("@marko/language-tools");
|
|
1530
1441
|
var import_vscode_languageserver7 = require("vscode-languageserver");
|
|
1531
1442
|
var import_babel_utils = require("@marko/babel-utils");
|
|
1532
1443
|
var markoErrorRegExp = /^(.+?)\.marko(?:\((\d+)(?:\s*,\s*(\d+))?\))?: (.*)$/gm;
|
|
@@ -1534,8 +1445,8 @@ var doValidate = (doc) => {
|
|
|
1534
1445
|
const filename = getFSPath(doc);
|
|
1535
1446
|
const diagnostics = [];
|
|
1536
1447
|
try {
|
|
1537
|
-
const { meta } =
|
|
1538
|
-
filename &&
|
|
1448
|
+
const { meta } = import_language_tools8.Project.getCompiler(
|
|
1449
|
+
filename && import_path5.default.dirname(filename)
|
|
1539
1450
|
).compileSync(doc.getText(), filename || "untitled.marko", {
|
|
1540
1451
|
code: false,
|
|
1541
1452
|
output: "migrate",
|
|
@@ -1666,7 +1577,7 @@ function isErrorWithLoc(err) {
|
|
|
1666
1577
|
}
|
|
1667
1578
|
|
|
1668
1579
|
// src/service/marko/hover/index.ts
|
|
1669
|
-
var
|
|
1580
|
+
var import_language_tools9 = require("@marko/language-tools");
|
|
1670
1581
|
|
|
1671
1582
|
// src/utils/constants.ts
|
|
1672
1583
|
var START_POSITION = {
|
|
@@ -1710,7 +1621,7 @@ var doHover = async (doc, params) => {
|
|
|
1710
1621
|
const file = getMarkoFile(doc);
|
|
1711
1622
|
const offset = doc.offsetAt(params.position);
|
|
1712
1623
|
const node = file.parsed.nodeAt(offset);
|
|
1713
|
-
return await ((_a = handlers2[
|
|
1624
|
+
return await ((_a = handlers2[import_language_tools9.NodeType[node.type]]) == null ? void 0 : _a.call(handlers2, {
|
|
1714
1625
|
file,
|
|
1715
1626
|
params,
|
|
1716
1627
|
offset,
|
|
@@ -1719,12 +1630,12 @@ var doHover = async (doc, params) => {
|
|
|
1719
1630
|
};
|
|
1720
1631
|
|
|
1721
1632
|
// src/service/marko/definition/index.ts
|
|
1722
|
-
var
|
|
1633
|
+
var import_language_tools12 = require("@marko/language-tools");
|
|
1723
1634
|
|
|
1724
1635
|
// src/service/marko/definition/AttrName.ts
|
|
1725
1636
|
var import_fs2 = __toESM(require("fs"));
|
|
1726
1637
|
var import_vscode_uri4 = require("vscode-uri");
|
|
1727
|
-
var
|
|
1638
|
+
var import_language_tools10 = require("@marko/language-tools");
|
|
1728
1639
|
|
|
1729
1640
|
// src/utils/regexp-builder.ts
|
|
1730
1641
|
function RegExpBuilder(strings, ...expressions) {
|
|
@@ -1773,8 +1684,8 @@ function AttrName2({
|
|
|
1773
1684
|
tagDefSource
|
|
1774
1685
|
);
|
|
1775
1686
|
if (match && match.index) {
|
|
1776
|
-
range = (0,
|
|
1777
|
-
(0,
|
|
1687
|
+
range = (0, import_language_tools10.getLocation)(
|
|
1688
|
+
(0, import_language_tools10.getLines)(tagDefSource),
|
|
1778
1689
|
match.index,
|
|
1779
1690
|
match.index + match[0].length
|
|
1780
1691
|
);
|
|
@@ -1792,9 +1703,9 @@ function AttrName2({
|
|
|
1792
1703
|
|
|
1793
1704
|
// src/service/marko/definition/OpenTagName.ts
|
|
1794
1705
|
var import_fs3 = __toESM(require("fs"));
|
|
1795
|
-
var
|
|
1706
|
+
var import_path6 = __toESM(require("path"));
|
|
1796
1707
|
var import_vscode_uri5 = require("vscode-uri");
|
|
1797
|
-
var
|
|
1708
|
+
var import_language_tools11 = require("@marko/language-tools");
|
|
1798
1709
|
function OpenTagName3({
|
|
1799
1710
|
node,
|
|
1800
1711
|
file: { parsed, lookup }
|
|
@@ -1802,9 +1713,9 @@ function OpenTagName3({
|
|
|
1802
1713
|
const tag = node.parent;
|
|
1803
1714
|
let tagDef;
|
|
1804
1715
|
let range = START_LOCATION;
|
|
1805
|
-
if (tag.type ===
|
|
1716
|
+
if (tag.type === import_language_tools11.NodeType.AttrTag) {
|
|
1806
1717
|
let parentTag = tag.owner;
|
|
1807
|
-
while ((parentTag == null ? void 0 : parentTag.type) ===
|
|
1718
|
+
while ((parentTag == null ? void 0 : parentTag.type) === import_language_tools11.NodeType.AttrTag)
|
|
1808
1719
|
parentTag = parentTag.owner;
|
|
1809
1720
|
tagDef = parentTag && parentTag.nameText ? lookup.getTag(parentTag.nameText) : void 0;
|
|
1810
1721
|
} else {
|
|
@@ -1814,7 +1725,7 @@ function OpenTagName3({
|
|
|
1814
1725
|
return;
|
|
1815
1726
|
}
|
|
1816
1727
|
const tagEntryFile = tagDef.template || tagDef.renderer || tagDef.filePath;
|
|
1817
|
-
if (!
|
|
1728
|
+
if (!import_path6.default.isAbsolute(tagEntryFile)) {
|
|
1818
1729
|
return;
|
|
1819
1730
|
}
|
|
1820
1731
|
if (/\/marko(?:-tag)?\.json$/.test(tagEntryFile)) {
|
|
@@ -1823,8 +1734,8 @@ function OpenTagName3({
|
|
|
1823
1734
|
tagDefSource
|
|
1824
1735
|
);
|
|
1825
1736
|
if (match && match.index) {
|
|
1826
|
-
range = (0,
|
|
1827
|
-
(0,
|
|
1737
|
+
range = (0, import_language_tools11.getLocation)(
|
|
1738
|
+
(0, import_language_tools11.getLines)(tagDefSource),
|
|
1828
1739
|
match.index,
|
|
1829
1740
|
match.index + match[0].length
|
|
1830
1741
|
);
|
|
@@ -1850,7 +1761,7 @@ var findDefinition = async (doc, params) => {
|
|
|
1850
1761
|
const file = getMarkoFile(doc);
|
|
1851
1762
|
const offset = doc.offsetAt(params.position);
|
|
1852
1763
|
const node = file.parsed.nodeAt(offset);
|
|
1853
|
-
return await ((_a = handlers3[
|
|
1764
|
+
return await ((_a = handlers3[import_language_tools12.NodeType[node.type]]) == null ? void 0 : _a.call(handlers3, {
|
|
1854
1765
|
file,
|
|
1855
1766
|
params,
|
|
1856
1767
|
offset,
|
|
@@ -1859,7 +1770,7 @@ var findDefinition = async (doc, params) => {
|
|
|
1859
1770
|
};
|
|
1860
1771
|
|
|
1861
1772
|
// src/service/marko/document-links.ts
|
|
1862
|
-
var
|
|
1773
|
+
var import_language_tools13 = require("@marko/language-tools");
|
|
1863
1774
|
var importTagReg2 = /(['"])<((?:[^\1\\>]+|\\.)*)>?\1/g;
|
|
1864
1775
|
var findDocumentLinks = async (doc) => {
|
|
1865
1776
|
return processDoc(doc, extractDocumentLinks);
|
|
@@ -1878,14 +1789,14 @@ function extractDocumentLinks({
|
|
|
1878
1789
|
const { program, read } = parsed;
|
|
1879
1790
|
const visit = (node) => {
|
|
1880
1791
|
switch (node.type) {
|
|
1881
|
-
case
|
|
1792
|
+
case import_language_tools13.NodeType.AttrTag:
|
|
1882
1793
|
if (node.body) {
|
|
1883
1794
|
for (const child of node.body) {
|
|
1884
1795
|
visit(child);
|
|
1885
1796
|
}
|
|
1886
1797
|
}
|
|
1887
1798
|
break;
|
|
1888
|
-
case
|
|
1799
|
+
case import_language_tools13.NodeType.Tag:
|
|
1889
1800
|
if (node.attrs && node.nameText) {
|
|
1890
1801
|
for (const attr of node.attrs) {
|
|
1891
1802
|
if (isDocumentLinkAttr(code, node, attr)) {
|
|
@@ -1911,7 +1822,7 @@ function extractDocumentLinks({
|
|
|
1911
1822
|
}
|
|
1912
1823
|
};
|
|
1913
1824
|
for (const node of program.static) {
|
|
1914
|
-
if (node.type ===
|
|
1825
|
+
if (node.type === import_language_tools13.NodeType.Import) {
|
|
1915
1826
|
importTagReg2.lastIndex = 0;
|
|
1916
1827
|
const value = parsed.read(node);
|
|
1917
1828
|
const match = importTagReg2.exec(value);
|
|
@@ -1939,7 +1850,7 @@ function extractDocumentLinks({
|
|
|
1939
1850
|
|
|
1940
1851
|
// src/service/marko/document-symbols.ts
|
|
1941
1852
|
var import_vscode_languageserver8 = require("vscode-languageserver");
|
|
1942
|
-
var
|
|
1853
|
+
var import_language_tools14 = require("@marko/language-tools");
|
|
1943
1854
|
var findDocumentSymbols = async (doc) => processDoc(doc, extractDocumentSymbols);
|
|
1944
1855
|
function extractDocumentSymbols({
|
|
1945
1856
|
uri,
|
|
@@ -1955,10 +1866,10 @@ function extractDocumentSymbols({
|
|
|
1955
1866
|
const visit = (node) => {
|
|
1956
1867
|
var _a, _b;
|
|
1957
1868
|
switch (node.type) {
|
|
1958
|
-
case
|
|
1959
|
-
case
|
|
1869
|
+
case import_language_tools14.NodeType.Tag:
|
|
1870
|
+
case import_language_tools14.NodeType.AttrTag:
|
|
1960
1871
|
symbols.push({
|
|
1961
|
-
name: (node.type ===
|
|
1872
|
+
name: (node.type === import_language_tools14.NodeType.AttrTag ? (_a = node.nameText) == null ? void 0 : _a.slice(node.nameText.indexOf("@")) : node.nameText) || "<${...}>",
|
|
1962
1873
|
kind: node.nameText && ((_b = lookup.getTag(node.nameText)) == null ? void 0 : _b.html) && import_vscode_languageserver8.SymbolKind.Property || import_vscode_languageserver8.SymbolKind.Class,
|
|
1963
1874
|
location: {
|
|
1964
1875
|
uri,
|
|
@@ -1983,7 +1894,7 @@ function extractDocumentSymbols({
|
|
|
1983
1894
|
var import_vscode_languageserver9 = require("vscode-languageserver");
|
|
1984
1895
|
var prettier = __toESM(require("prettier"));
|
|
1985
1896
|
var markoPrettier = __toESM(require("prettier-plugin-marko"));
|
|
1986
|
-
var
|
|
1897
|
+
var import_language_tools15 = require("@marko/language-tools");
|
|
1987
1898
|
var format2 = async (doc, params, cancel) => {
|
|
1988
1899
|
try {
|
|
1989
1900
|
const dir = getFSDir(doc);
|
|
@@ -2001,14 +1912,14 @@ var format2 = async (doc, params, cancel) => {
|
|
|
2001
1912
|
};
|
|
2002
1913
|
if (cancel.isCancellationRequested)
|
|
2003
1914
|
return;
|
|
2004
|
-
markoPrettier.setCompiler(
|
|
1915
|
+
markoPrettier.setCompiler(import_language_tools15.Project.getCompiler(dir), import_language_tools15.Project.getConfig(dir));
|
|
2005
1916
|
const ret = [
|
|
2006
1917
|
import_vscode_languageserver9.TextEdit.replace(
|
|
2007
1918
|
{
|
|
2008
1919
|
start: START_POSITION,
|
|
2009
1920
|
end: doc.positionAt(text.length)
|
|
2010
1921
|
},
|
|
2011
|
-
prettier.format(text, options)
|
|
1922
|
+
await prettier.format(text, options)
|
|
2012
1923
|
)
|
|
2013
1924
|
];
|
|
2014
1925
|
return ret;
|
|
@@ -2029,33 +1940,22 @@ var marko_default = {
|
|
|
2029
1940
|
};
|
|
2030
1941
|
|
|
2031
1942
|
// src/service/script/index.ts
|
|
2032
|
-
var
|
|
1943
|
+
var import_path8 = __toESM(require("path"));
|
|
2033
1944
|
var import_relative_import_path = require("relative-import-path");
|
|
2034
1945
|
var import_tsserverlibrary = __toESM(require("typescript/lib/tsserverlibrary"));
|
|
2035
1946
|
var import_vscode_languageserver10 = require("vscode-languageserver");
|
|
2036
1947
|
var import_vscode_uri6 = require("vscode-uri");
|
|
2037
1948
|
var prettier2 = __toESM(require("prettier"));
|
|
2038
|
-
var
|
|
1949
|
+
var import_language_tools17 = require("@marko/language-tools");
|
|
2039
1950
|
|
|
2040
1951
|
// src/ts-plugin/host.ts
|
|
2041
|
-
var
|
|
2042
|
-
var
|
|
2043
|
-
var import_config = __toESM(require("@marko/compiler/config"));
|
|
2044
|
-
var defaultTranslator = __toESM(require("@marko/translator-default"));
|
|
2045
|
-
var import_language_tools15 = require("@marko/language-tools");
|
|
1952
|
+
var import_path7 = __toESM(require("path"));
|
|
1953
|
+
var import_language_tools16 = require("@marko/language-tools");
|
|
2046
1954
|
var fsPathReg = /^(?:[./\\]|[A-Z]:)/i;
|
|
2047
1955
|
var modulePartsReg = /^((?:@(?:[^/]+)\/)?(?:[^/]+))(.*)$/;
|
|
2048
|
-
import_language_tools15.Project.setDefaultTypePaths({
|
|
2049
|
-
internalTypesFile: import_path6.default.join(__dirname, "marko.internal.d.ts"),
|
|
2050
|
-
markoTypesFile: import_path6.default.join(__dirname, "marko.runtime.d.ts")
|
|
2051
|
-
});
|
|
2052
|
-
import_language_tools15.Project.setDefaultCompilerMeta(defaultCompiler, {
|
|
2053
|
-
...import_config.default,
|
|
2054
|
-
translator: defaultTranslator
|
|
2055
|
-
});
|
|
2056
1956
|
function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
|
|
2057
1957
|
var _a, _b, _c;
|
|
2058
|
-
const processors =
|
|
1958
|
+
const processors = import_language_tools16.Processors.create({
|
|
2059
1959
|
ts: ts2,
|
|
2060
1960
|
host,
|
|
2061
1961
|
configFile
|
|
@@ -2119,10 +2019,10 @@ function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
|
|
|
2119
2019
|
}
|
|
2120
2020
|
const readDirectory2 = (_b = host.readDirectory) == null ? void 0 : _b.bind(host);
|
|
2121
2021
|
if (readDirectory2) {
|
|
2122
|
-
host.readDirectory = (
|
|
2022
|
+
host.readDirectory = (path9, extensions, exclude, include, depth) => {
|
|
2123
2023
|
return readDirectory2(
|
|
2124
|
-
|
|
2125
|
-
extensions == null ? void 0 : extensions.concat(
|
|
2024
|
+
path9,
|
|
2025
|
+
extensions == null ? void 0 : extensions.concat(import_language_tools16.Processors.extensions),
|
|
2126
2026
|
exclude,
|
|
2127
2027
|
include,
|
|
2128
2028
|
depth
|
|
@@ -2141,7 +2041,7 @@ function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
|
|
|
2141
2041
|
if (processor) {
|
|
2142
2042
|
let resolvedFileName;
|
|
2143
2043
|
if (fsPathReg.test(moduleName)) {
|
|
2144
|
-
resolvedFileName =
|
|
2044
|
+
resolvedFileName = import_path7.default.resolve(containingFile, "..", moduleName);
|
|
2145
2045
|
} else {
|
|
2146
2046
|
const [, nodeModuleName, relativeModulePath] = modulePartsReg.exec(moduleName);
|
|
2147
2047
|
const { resolvedModule } = ts2.nodeModuleNameResolver(
|
|
@@ -2153,7 +2053,7 @@ function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
|
|
|
2153
2053
|
redirectedReference
|
|
2154
2054
|
);
|
|
2155
2055
|
if (resolvedModule) {
|
|
2156
|
-
resolvedFileName =
|
|
2056
|
+
resolvedFileName = import_path7.default.join(
|
|
2157
2057
|
resolvedModule.resolvedFileName,
|
|
2158
2058
|
"..",
|
|
2159
2059
|
relativeModulePath
|
|
@@ -2169,12 +2069,12 @@ function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
|
|
|
2169
2069
|
}
|
|
2170
2070
|
}
|
|
2171
2071
|
if (resolvedFileName) {
|
|
2172
|
-
if ((0,
|
|
2072
|
+
if ((0, import_language_tools16.isDefinitionFile)(resolvedFileName)) {
|
|
2173
2073
|
if (!host.fileExists(resolvedFileName)) {
|
|
2174
2074
|
resolvedFileName = void 0;
|
|
2175
2075
|
}
|
|
2176
2076
|
} else {
|
|
2177
|
-
const ext = (0,
|
|
2077
|
+
const ext = (0, import_language_tools16.getExt)(resolvedFileName);
|
|
2178
2078
|
const definitionFile = `${resolvedFileName.slice(
|
|
2179
2079
|
0,
|
|
2180
2080
|
-ext.length
|
|
@@ -2222,7 +2122,7 @@ function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
|
|
|
2222
2122
|
}
|
|
2223
2123
|
return host;
|
|
2224
2124
|
function getProcessor(fileName) {
|
|
2225
|
-
const ext = (0,
|
|
2125
|
+
const ext = (0, import_language_tools16.getExt)(fileName);
|
|
2226
2126
|
return ext ? processors[ext] : void 0;
|
|
2227
2127
|
}
|
|
2228
2128
|
}
|
|
@@ -2428,7 +2328,7 @@ var ScriptService = {
|
|
|
2428
2328
|
return;
|
|
2429
2329
|
const tsProject = getTSProject(filename);
|
|
2430
2330
|
const extracted = processScript(doc, tsProject);
|
|
2431
|
-
const lang =
|
|
2331
|
+
const lang = import_language_tools17.Project.getScriptLang(
|
|
2432
2332
|
filename,
|
|
2433
2333
|
tsProject.markoScriptLang,
|
|
2434
2334
|
import_tsserverlibrary.default,
|
|
@@ -2438,14 +2338,14 @@ var ScriptService = {
|
|
|
2438
2338
|
const content = (() => {
|
|
2439
2339
|
try {
|
|
2440
2340
|
return prettier2.format(generated, {
|
|
2441
|
-
parser: lang ===
|
|
2341
|
+
parser: lang === import_language_tools17.ScriptLang.ts ? "typescript" : "babel"
|
|
2442
2342
|
});
|
|
2443
2343
|
} catch {
|
|
2444
2344
|
return generated;
|
|
2445
2345
|
}
|
|
2446
2346
|
})();
|
|
2447
2347
|
return {
|
|
2448
|
-
language: lang ===
|
|
2348
|
+
language: lang === import_language_tools17.ScriptLang.ts ? "typescript" : "javascript",
|
|
2449
2349
|
content
|
|
2450
2350
|
};
|
|
2451
2351
|
}
|
|
@@ -2501,7 +2401,7 @@ var ScriptService = {
|
|
|
2501
2401
|
let source = completion.source;
|
|
2502
2402
|
if (source && completion.hasAction) {
|
|
2503
2403
|
if (source[0] === ".") {
|
|
2504
|
-
source =
|
|
2404
|
+
source = import_path8.default.resolve(fileName, "..", source);
|
|
2505
2405
|
}
|
|
2506
2406
|
detail = (0, import_relative_import_path.relativeImportPath)(fileName, source);
|
|
2507
2407
|
sortText = `\uFFFF${sortText}`;
|
|
@@ -2808,12 +2708,12 @@ function processScript(doc, tsProject) {
|
|
|
2808
2708
|
return processDoc(doc, ({ filename, parsed, lookup }) => {
|
|
2809
2709
|
var _a;
|
|
2810
2710
|
const { host, markoScriptLang } = tsProject;
|
|
2811
|
-
return (0,
|
|
2711
|
+
return (0, import_language_tools17.extractScript)({
|
|
2812
2712
|
ts: import_tsserverlibrary.default,
|
|
2813
2713
|
parsed,
|
|
2814
2714
|
lookup,
|
|
2815
|
-
scriptLang: filename ?
|
|
2816
|
-
runtimeTypesCode: (_a =
|
|
2715
|
+
scriptLang: filename ? import_language_tools17.Project.getScriptLang(filename, markoScriptLang, import_tsserverlibrary.default, host) : markoScriptLang,
|
|
2716
|
+
runtimeTypesCode: (_a = import_language_tools17.Project.getTypeLibs(tsProject.rootDir, import_tsserverlibrary.default, host)) == null ? void 0 : _a.markoTypesCode
|
|
2817
2717
|
});
|
|
2818
2718
|
});
|
|
2819
2719
|
}
|
|
@@ -2824,9 +2724,9 @@ function getInsertModuleStatementOffset(parsed) {
|
|
|
2824
2724
|
let lastImport;
|
|
2825
2725
|
for (const node of program.static) {
|
|
2826
2726
|
switch (node.type) {
|
|
2827
|
-
case
|
|
2727
|
+
case import_language_tools17.NodeType.Export:
|
|
2828
2728
|
return node.start;
|
|
2829
|
-
case
|
|
2729
|
+
case import_language_tools17.NodeType.Import:
|
|
2830
2730
|
lastImport = node;
|
|
2831
2731
|
break;
|
|
2832
2732
|
}
|
|
@@ -2866,8 +2766,8 @@ function docLocationAtTextSpan(doc, { start, length }) {
|
|
|
2866
2766
|
}
|
|
2867
2767
|
function getTSConfigFile(fileName) {
|
|
2868
2768
|
let configFile;
|
|
2869
|
-
const docFsDir =
|
|
2870
|
-
const cache =
|
|
2769
|
+
const docFsDir = import_path8.default.dirname(fileName);
|
|
2770
|
+
const cache = import_language_tools17.Project.getCache(docFsDir);
|
|
2871
2771
|
let configFileCache = cache.get(getTSConfigFile);
|
|
2872
2772
|
if (configFileCache) {
|
|
2873
2773
|
configFile = configFileCache.get(docFsDir);
|
|
@@ -2884,15 +2784,15 @@ function getTSConfigFile(fileName) {
|
|
|
2884
2784
|
function getTSProject(docFsPath) {
|
|
2885
2785
|
var _a;
|
|
2886
2786
|
let configFile;
|
|
2887
|
-
let markoScriptLang =
|
|
2787
|
+
let markoScriptLang = import_language_tools17.ScriptLang.js;
|
|
2888
2788
|
if (docFsPath) {
|
|
2889
2789
|
configFile = getTSConfigFile(docFsPath);
|
|
2890
2790
|
if (configFile == null ? void 0 : configFile.endsWith("tsconfig.json")) {
|
|
2891
|
-
markoScriptLang =
|
|
2791
|
+
markoScriptLang = import_language_tools17.ScriptLang.ts;
|
|
2892
2792
|
}
|
|
2893
2793
|
}
|
|
2894
|
-
const rootDir = configFile &&
|
|
2895
|
-
const cache =
|
|
2794
|
+
const rootDir = configFile && import_path8.default.dirname(configFile) || process.cwd();
|
|
2795
|
+
const cache = import_language_tools17.Project.getCache(configFile && rootDir);
|
|
2896
2796
|
let projectCache = cache.get(getTSProject);
|
|
2897
2797
|
let cached;
|
|
2898
2798
|
if (projectCache) {
|
|
@@ -2917,8 +2817,8 @@ function getTSProject(docFsPath) {
|
|
|
2917
2817
|
fileNames.filter((file) => /\.[cm]?ts$/.test(file))
|
|
2918
2818
|
);
|
|
2919
2819
|
const tsPkgFile = configFile && ((_a = import_tsserverlibrary.default.resolveModuleName("typescript/package.json", configFile, options, import_tsserverlibrary.default.sys).resolvedModule) == null ? void 0 : _a.resolvedFileName);
|
|
2920
|
-
const defaultLibFile =
|
|
2921
|
-
tsPkgFile ?
|
|
2820
|
+
const defaultLibFile = import_path8.default.join(
|
|
2821
|
+
tsPkgFile ? import_path8.default.join(tsPkgFile, "../lib") : __dirname,
|
|
2922
2822
|
import_tsserverlibrary.default.getDefaultLibFileName(options)
|
|
2923
2823
|
);
|
|
2924
2824
|
const resolutionCache = import_tsserverlibrary.default.createModuleResolutionCache(
|
|
@@ -2989,7 +2889,7 @@ function getTSProject(docFsPath) {
|
|
|
2989
2889
|
return `${((_a2 = get(filenameToURI(filename))) == null ? void 0 : _a2.version) ?? -1}`;
|
|
2990
2890
|
},
|
|
2991
2891
|
getScriptKind(filename) {
|
|
2992
|
-
switch (
|
|
2892
|
+
switch (import_path8.default.extname(filename)) {
|
|
2993
2893
|
case import_tsserverlibrary.default.Extension.Js:
|
|
2994
2894
|
case import_tsserverlibrary.default.Extension.Cjs:
|
|
2995
2895
|
case import_tsserverlibrary.default.Extension.Mjs:
|
|
@@ -3035,7 +2935,7 @@ function filenameToURI(filename) {
|
|
|
3035
2935
|
}
|
|
3036
2936
|
async function getPreferences(scriptLang) {
|
|
3037
2937
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
3038
|
-
const configName = scriptLang ===
|
|
2938
|
+
const configName = scriptLang === import_language_tools17.ScriptLang.js ? "javascript" : "typescript";
|
|
3039
2939
|
const [preferencesConfig, suggestConfig, inlayHintsConfig] = await Promise.all([
|
|
3040
2940
|
getConfig(`${configName}.preferences`),
|
|
3041
2941
|
getConfig(`${configName}.suggest`),
|
|
@@ -3192,7 +3092,7 @@ function getCanonicalFileName(fileName) {
|
|
|
3192
3092
|
var import_vscode_css_languageservice2 = require("vscode-css-languageservice");
|
|
3193
3093
|
var import_vscode_languageserver11 = require("vscode-languageserver");
|
|
3194
3094
|
var import_vscode_languageserver_textdocument2 = require("vscode-languageserver-textdocument");
|
|
3195
|
-
var
|
|
3095
|
+
var import_language_tools18 = require("@marko/language-tools");
|
|
3196
3096
|
var services = {
|
|
3197
3097
|
".css": import_vscode_css_languageservice2.getCSSLanguageService,
|
|
3198
3098
|
".less": import_vscode_css_languageservice2.getLESSLanguageService,
|
|
@@ -3499,7 +3399,7 @@ function processStyle(doc) {
|
|
|
3499
3399
|
return processDoc(doc, ({ uri, version, parsed, lookup }) => {
|
|
3500
3400
|
var _a;
|
|
3501
3401
|
const result = [];
|
|
3502
|
-
for (const [ext, extracted] of (0,
|
|
3402
|
+
for (const [ext, extracted] of (0, import_language_tools18.extractStyle)({
|
|
3503
3403
|
parsed,
|
|
3504
3404
|
lookup
|
|
3505
3405
|
})) {
|
|
@@ -3670,10 +3570,12 @@ var service = {
|
|
|
3670
3570
|
},
|
|
3671
3571
|
async findDocumentSymbols(doc, params, cancel) {
|
|
3672
3572
|
const results = await Promise.allSettled(
|
|
3673
|
-
plugins.map(
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3573
|
+
plugins.map(
|
|
3574
|
+
(plugin) => {
|
|
3575
|
+
var _a;
|
|
3576
|
+
return (_a = plugin.findDocumentSymbols) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3577
|
+
}
|
|
3578
|
+
)
|
|
3677
3579
|
);
|
|
3678
3580
|
if (cancel.isCancellationRequested)
|
|
3679
3581
|
return;
|
|
@@ -4096,7 +3998,7 @@ for (const command in service.commands) {
|
|
|
4096
3998
|
}
|
|
4097
3999
|
function validateDocs() {
|
|
4098
4000
|
queueDiagnostic();
|
|
4099
|
-
|
|
4001
|
+
import_language_tools19.Project.clearCaches();
|
|
4100
4002
|
}
|
|
4101
4003
|
function queueDiagnostic() {
|
|
4102
4004
|
clearTimeout(diagnosticTimeout);
|