typedoc 0.28.2 → 0.28.4

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.
Files changed (33) hide show
  1. package/dist/browser-locales/de.d.ts +2 -0
  2. package/dist/browser-locales/de.js +62 -0
  3. package/dist/lib/cli.js +1 -1
  4. package/dist/lib/converter/context.js +2 -2
  5. package/dist/lib/converter/converter.d.ts +2 -2
  6. package/dist/lib/converter/converter.js +12 -5
  7. package/dist/lib/converter/plugins/ImplementsPlugin.js +12 -0
  8. package/dist/lib/converter/plugins/IncludePlugin.js +2 -0
  9. package/dist/lib/converter/symbols.js +2 -1
  10. package/dist/lib/converter/types.js +15 -0
  11. package/dist/lib/internationalization/locales/de.cjs +402 -0
  12. package/dist/lib/internationalization/locales/de.d.cts +369 -0
  13. package/dist/lib/internationalization/locales/en.cjs +1 -1
  14. package/dist/lib/internationalization/locales/en.d.cts +1 -1
  15. package/dist/lib/internationalization/locales/ja.cjs +0 -1
  16. package/dist/lib/internationalization/locales/zh.cjs +0 -1
  17. package/dist/lib/internationalization/locales/zh.d.cts +0 -1
  18. package/dist/lib/models/types.js +255 -207
  19. package/dist/lib/output/themes/MarkedPlugin.js +5 -0
  20. package/dist/lib/output/themes/default/partials/icon.d.ts +1 -0
  21. package/dist/lib/output/themes/default/partials/index.js +1 -1
  22. package/dist/lib/output/themes/lib.js +8 -11
  23. package/dist/lib/utils/entry-point.js +0 -3
  24. package/dist/lib/utils/highlighter.js +3 -2
  25. package/dist/lib/utils/options/declaration.js +11 -1
  26. package/dist/lib/utils/options/readers/arguments.d.ts +2 -0
  27. package/dist/lib/utils/options/readers/arguments.js +17 -4
  28. package/dist/lib/utils-common/array.d.ts +1 -0
  29. package/dist/lib/utils-common/array.js +1 -0
  30. package/dist/lib/utils-common/events.d.ts +1 -0
  31. package/dist/lib/utils-common/events.js +1 -0
  32. package/package.json +1 -1
  33. package/static/main.js +4 -4
@@ -1,7 +1,41 @@
1
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
+ var _, done = false;
7
+ for (var i = decorators.length - 1; i >= 0; i--) {
8
+ var context = {};
9
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
+ if (kind === "accessor") {
14
+ if (result === void 0) continue;
15
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
+ if (_ = accept(result.get)) descriptor.get = _;
17
+ if (_ = accept(result.set)) descriptor.set = _;
18
+ if (_ = accept(result.init)) initializers.unshift(_);
19
+ }
20
+ else if (_ = accept(result)) {
21
+ if (kind === "field") initializers.unshift(_);
22
+ else descriptor[key] = _;
23
+ }
24
+ }
25
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
+ done = true;
27
+ };
28
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
+ var useValue = arguments.length > 2;
30
+ for (var i = 0; i < initializers.length; i++) {
31
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
+ }
33
+ return useValue ? value : void 0;
34
+ };
1
35
  import { ReflectionSymbolId } from "./ReflectionSymbolId.js";
2
36
  import { ReflectionKind } from "./kind.js";
3
37
  import { Comment } from "./Comment.js";
4
- import { i18n, joinArray } from "#utils";
38
+ import { i18n, joinArray, NonEnumerable } from "#utils";
5
39
  /**
6
40
  * Base class of all type definitions.
7
41
  * @category Types
@@ -658,227 +692,241 @@ export class QueryType extends Type {
658
692
  * ```
659
693
  * @category Types
660
694
  */
661
- export class ReferenceType extends Type {
662
- type = "reference";
663
- /**
664
- * The name of the referenced type.
665
- *
666
- * If the symbol cannot be found because it's not part of the documentation this
667
- * can be used to represent the type.
668
- */
669
- name;
670
- /**
671
- * The type arguments of this reference.
672
- */
673
- typeArguments;
674
- /**
675
- * The resolved reflection.
676
- */
677
- get reflection() {
678
- if (typeof this._target === "number") {
679
- return this._project?.getReflectionById(this._target);
680
- }
681
- const resolvePotential = this._project?.getReflectionsFromSymbolId(this._target);
682
- if (!resolvePotential?.length) {
683
- return;
684
- }
685
- const kind = this.preferValues
686
- ? ReflectionKind.ValueReferenceTarget
687
- : ReflectionKind.TypeReferenceTarget;
688
- const resolved = resolvePotential.find((refl) => refl.kindOf(kind)) ||
689
- resolvePotential.find((refl) => refl.kindOf(~kind));
690
- // Do not mark the type as resolved at this point so that if it
691
- // points to a member which is removed (e.g. by typedoc-plugin-zod)
692
- // and then replaced it still ends up pointing at the right reflection.
693
- // We will lock type reference resolution when serializing to JSON.
694
- // this._target = resolved.id;
695
- return resolved;
696
- }
697
- /**
698
- * Sometimes a few properties are more important than the rest
699
- * of the properties within a type. This occurs most often with
700
- * object parameters, where users want to specify `@param foo.bar`
701
- * to highlight something about the `bar` property.
702
- *
703
- * Does NOT support nested properties.
704
- */
705
- highlightedProperties;
706
- /**
707
- * If not resolved, the symbol id of the reflection, otherwise undefined.
708
- */
709
- get symbolId() {
710
- if (!this.reflection && typeof this._target === "object") {
711
- return this._target;
712
- }
713
- }
714
- /**
715
- * Checks if this type is a reference type because it uses a name, but is intentionally not pointing
716
- * to a reflection. This happens for type parameters and when representing a mapped type.
717
- */
718
- isIntentionallyBroken() {
719
- if (typeof this._target === "object" &&
720
- this._project?.symbolIdHasBeenRemoved(this._target)) {
721
- return true;
695
+ let ReferenceType = (() => {
696
+ let _classSuper = Type;
697
+ let __project_decorators;
698
+ let __project_initializers = [];
699
+ let __project_extraInitializers = [];
700
+ return class ReferenceType extends _classSuper {
701
+ static {
702
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
703
+ __project_decorators = [NonEnumerable];
704
+ __esDecorate(null, null, __project_decorators, { kind: "field", name: "_project", static: false, private: false, access: { has: obj => "_project" in obj, get: obj => obj._project, set: (obj, value) => { obj._project = value; } }, metadata: _metadata }, __project_initializers, __project_extraInitializers);
705
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
722
706
  }
723
- return this._target === -1 || this.refersToTypeParameter;
724
- }
725
- /**
726
- * Convert this reference type to a declaration reference used for resolution of external types.
727
- */
728
- toDeclarationReference() {
729
- return {
730
- resolutionStart: "global",
731
- moduleSource: this.package,
732
- symbolReference: {
733
- path: this.qualifiedName
734
- .split(".")
735
- .map((p) => ({ path: p, navigation: "." })),
736
- },
737
- };
738
- }
739
- /**
740
- * The fully qualified name of the referenced type, relative to the file it is defined in.
741
- * This will usually be the same as `name`, unless namespaces are used.
742
- */
743
- qualifiedName;
744
- /**
745
- * The package that this type is referencing.
746
- */
747
- package;
748
- /**
749
- * If this reference type refers to a reflection defined by a project not being rendered,
750
- * points to the url that this type should be linked to.
751
- */
752
- externalUrl;
753
- /**
754
- * If set, no warnings about something not being exported should be created
755
- * since this may be referring to a type created with `infer X` which will not
756
- * be registered on the project.
757
- */
758
- refersToTypeParameter = false;
759
- /**
760
- * If set, will prefer reflections with {@link ReflectionKind | ReflectionKinds} which represent
761
- * values rather than those which represent types.
762
- */
763
- preferValues = false;
764
- _target;
765
- _project;
766
- constructor(name, target, project, qualifiedName) {
767
- super();
768
- this.name = name;
769
- if (typeof target === "number") {
770
- this._target = target;
707
+ type = "reference";
708
+ /**
709
+ * The name of the referenced type.
710
+ *
711
+ * If the symbol cannot be found because it's not part of the documentation this
712
+ * can be used to represent the type.
713
+ */
714
+ name;
715
+ /**
716
+ * The type arguments of this reference.
717
+ */
718
+ typeArguments;
719
+ /**
720
+ * The resolved reflection.
721
+ */
722
+ get reflection() {
723
+ if (typeof this._target === "number") {
724
+ return this._project?.getReflectionById(this._target);
725
+ }
726
+ const resolvePotential = this._project?.getReflectionsFromSymbolId(this._target);
727
+ if (!resolvePotential?.length) {
728
+ return;
729
+ }
730
+ const kind = this.preferValues
731
+ ? ReflectionKind.ValueReferenceTarget
732
+ : ReflectionKind.TypeReferenceTarget;
733
+ const resolved = resolvePotential.find((refl) => refl.kindOf(kind)) ||
734
+ resolvePotential.find((refl) => refl.kindOf(~kind));
735
+ // Do not mark the type as resolved at this point so that if it
736
+ // points to a member which is removed (e.g. by typedoc-plugin-zod)
737
+ // and then replaced it still ends up pointing at the right reflection.
738
+ // We will lock type reference resolution when serializing to JSON.
739
+ // this._target = resolved.id;
740
+ return resolved;
771
741
  }
772
- else {
773
- this._target = "variant" in target ? target.id : target;
742
+ /**
743
+ * Sometimes a few properties are more important than the rest
744
+ * of the properties within a type. This occurs most often with
745
+ * object parameters, where users want to specify `@param foo.bar`
746
+ * to highlight something about the `bar` property.
747
+ *
748
+ * Does NOT support nested properties.
749
+ */
750
+ highlightedProperties;
751
+ /**
752
+ * If not resolved, the symbol id of the reflection, otherwise undefined.
753
+ */
754
+ get symbolId() {
755
+ if (!this.reflection && typeof this._target === "object") {
756
+ return this._target;
757
+ }
774
758
  }
775
- this._project = project;
776
- this.qualifiedName = qualifiedName;
777
- }
778
- static createUnresolvedReference(name, target, project, qualifiedName) {
779
- return new ReferenceType(name, target, project, qualifiedName);
780
- }
781
- static createResolvedReference(name, target, project) {
782
- return new ReferenceType(name, target, project, name);
783
- }
784
- /**
785
- * This is used for type parameters, which don't actually point to something,
786
- * and also for temporary references which will be cleaned up with real references
787
- * later during conversion.
788
- * @internal
789
- */
790
- static createBrokenReference(name, project) {
791
- return new ReferenceType(name, -1, project, name);
792
- }
793
- getTypeString() {
794
- const name = this.reflection ? this.reflection.name : this.name;
795
- let typeArgs = "";
796
- if (this.typeArguments && this.typeArguments.length > 0) {
797
- typeArgs += "<";
798
- typeArgs += this.typeArguments
799
- .map((arg) => arg.stringify(TypeContext.referenceTypeArgument))
800
- .join(", ");
801
- typeArgs += ">";
759
+ /**
760
+ * Checks if this type is a reference type because it uses a name, but is intentionally not pointing
761
+ * to a reflection. This happens for type parameters and when representing a mapped type.
762
+ */
763
+ isIntentionallyBroken() {
764
+ if (typeof this._target === "object" &&
765
+ this._project?.symbolIdHasBeenRemoved(this._target)) {
766
+ return true;
767
+ }
768
+ return this._target === -1 || this.refersToTypeParameter;
802
769
  }
803
- return name + typeArgs;
804
- }
805
- needsParenthesis() {
806
- return false;
807
- }
808
- toObject(serializer) {
809
- let target;
810
- if (typeof this._target === "number") {
811
- target = this._target;
770
+ /**
771
+ * Convert this reference type to a declaration reference used for resolution of external types.
772
+ */
773
+ toDeclarationReference() {
774
+ return {
775
+ resolutionStart: "global",
776
+ moduleSource: this.package,
777
+ symbolReference: {
778
+ path: this.qualifiedName
779
+ .split(".")
780
+ .map((p) => ({ path: p, navigation: "." })),
781
+ },
782
+ };
812
783
  }
813
- else if (this._project?.symbolIdHasBeenRemoved(this._target)) {
814
- target = -1;
784
+ /**
785
+ * The fully qualified name of the referenced type, relative to the file it is defined in.
786
+ * This will usually be the same as `name`, unless namespaces are used.
787
+ */
788
+ qualifiedName;
789
+ /**
790
+ * The package that this type is referencing.
791
+ */
792
+ package;
793
+ /**
794
+ * If this reference type refers to a reflection defined by a project not being rendered,
795
+ * points to the url that this type should be linked to.
796
+ */
797
+ externalUrl;
798
+ /**
799
+ * If set, no warnings about something not being exported should be created
800
+ * since this may be referring to a type created with `infer X` which will not
801
+ * be registered on the project.
802
+ */
803
+ refersToTypeParameter = false;
804
+ /**
805
+ * If set, will prefer reflections with {@link ReflectionKind | ReflectionKinds} which represent
806
+ * values rather than those which represent types.
807
+ */
808
+ preferValues = false;
809
+ _target;
810
+ _project = __runInitializers(this, __project_initializers, void 0);
811
+ constructor(name, target, project, qualifiedName) {
812
+ super();
813
+ __runInitializers(this, __project_extraInitializers);
814
+ this.name = name;
815
+ if (typeof target === "number") {
816
+ this._target = target;
817
+ }
818
+ else {
819
+ this._target = "variant" in target ? target.id : target;
820
+ }
821
+ this._project = project;
822
+ this.qualifiedName = qualifiedName;
815
823
  }
816
- else if (this.reflection) {
817
- target = this.reflection.id;
824
+ static createUnresolvedReference(name, target, project, qualifiedName) {
825
+ return new ReferenceType(name, target, project, qualifiedName);
818
826
  }
819
- else {
820
- target = this._target.toObject();
827
+ static createResolvedReference(name, target, project) {
828
+ return new ReferenceType(name, target, project, name);
821
829
  }
822
- const result = {
823
- type: this.type,
824
- target,
825
- typeArguments: serializer.toObjectsOptional(this.typeArguments),
826
- name: this.name,
827
- package: this.package,
828
- externalUrl: this.externalUrl,
829
- };
830
- if (this.name !== this.qualifiedName) {
831
- result.qualifiedName = this.qualifiedName;
830
+ /**
831
+ * This is used for type parameters, which don't actually point to something,
832
+ * and also for temporary references which will be cleaned up with real references
833
+ * later during conversion.
834
+ * @internal
835
+ */
836
+ static createBrokenReference(name, project) {
837
+ return new ReferenceType(name, -1, project, name);
832
838
  }
833
- if (this.refersToTypeParameter) {
834
- result.refersToTypeParameter = true;
839
+ getTypeString() {
840
+ const name = this.reflection ? this.reflection.name : this.name;
841
+ let typeArgs = "";
842
+ if (this.typeArguments && this.typeArguments.length > 0) {
843
+ typeArgs += "<";
844
+ typeArgs += this.typeArguments
845
+ .map((arg) => arg.stringify(TypeContext.referenceTypeArgument))
846
+ .join(", ");
847
+ typeArgs += ">";
848
+ }
849
+ return name + typeArgs;
835
850
  }
836
- if (typeof target !== "number" && this.preferValues) {
837
- result.preferValues = true;
851
+ needsParenthesis() {
852
+ return false;
838
853
  }
839
- if (this.highlightedProperties) {
840
- result.highlightedProperties = Object.fromEntries(Array.from(this.highlightedProperties.entries(), ([key, parts]) => {
841
- return [
842
- key,
843
- Comment.serializeDisplayParts(parts),
844
- ];
845
- }));
854
+ toObject(serializer) {
855
+ let target;
856
+ if (typeof this._target === "number") {
857
+ target = this._target;
858
+ }
859
+ else if (this._project?.symbolIdHasBeenRemoved(this._target)) {
860
+ target = -1;
861
+ }
862
+ else if (this.reflection) {
863
+ target = this.reflection.id;
864
+ }
865
+ else {
866
+ target = this._target.toObject();
867
+ }
868
+ const result = {
869
+ type: this.type,
870
+ target,
871
+ typeArguments: serializer.toObjectsOptional(this.typeArguments),
872
+ name: this.name,
873
+ package: this.package,
874
+ externalUrl: this.externalUrl,
875
+ };
876
+ if (this.name !== this.qualifiedName) {
877
+ result.qualifiedName = this.qualifiedName;
878
+ }
879
+ if (this.refersToTypeParameter) {
880
+ result.refersToTypeParameter = true;
881
+ }
882
+ if (typeof target !== "number" && this.preferValues) {
883
+ result.preferValues = true;
884
+ }
885
+ if (this.highlightedProperties) {
886
+ result.highlightedProperties = Object.fromEntries(Array.from(this.highlightedProperties.entries(), ([key, parts]) => {
887
+ return [
888
+ key,
889
+ Comment.serializeDisplayParts(parts),
890
+ ];
891
+ }));
892
+ }
893
+ return result;
846
894
  }
847
- return result;
848
- }
849
- fromObject(de, obj) {
850
- this.typeArguments = de.reviveMany(obj.typeArguments, (t) => de.constructType(t));
851
- if (typeof obj.target === "number" && obj.target !== -1) {
852
- de.defer((project) => {
853
- const target = project.getReflectionById(de.oldIdToNewId[obj.target] ?? -1);
854
- if (target) {
855
- this._project = project;
856
- this._target = target.id;
857
- }
858
- else {
859
- de.logger.warn(i18n.serialized_project_referenced_0_not_part_of_project(JSON.stringify(obj.target)));
895
+ fromObject(de, obj) {
896
+ this.typeArguments = de.reviveMany(obj.typeArguments, (t) => de.constructType(t));
897
+ if (typeof obj.target === "number" && obj.target !== -1) {
898
+ de.defer((project) => {
899
+ const target = project.getReflectionById(de.oldIdToNewId[obj.target] ?? -1);
900
+ if (target) {
901
+ this._project = project;
902
+ this._target = target.id;
903
+ }
904
+ else {
905
+ de.logger.warn(i18n.serialized_project_referenced_0_not_part_of_project(JSON.stringify(obj.target)));
906
+ }
907
+ });
908
+ }
909
+ else if (obj.target === -1) {
910
+ this._target = -1;
911
+ }
912
+ else {
913
+ this._project = de.project;
914
+ this._target = new ReflectionSymbolId(obj.target);
915
+ }
916
+ this.qualifiedName = obj.qualifiedName ?? obj.name;
917
+ this.package = obj.package;
918
+ this.refersToTypeParameter = !!obj.refersToTypeParameter;
919
+ this.preferValues = !!obj.preferValues;
920
+ if (obj.highlightedProperties) {
921
+ this.highlightedProperties = new Map();
922
+ for (const [key, parts] of Object.entries(obj.highlightedProperties)) {
923
+ this.highlightedProperties.set(key, Comment.deserializeDisplayParts(de, parts));
860
924
  }
861
- });
862
- }
863
- else if (obj.target === -1) {
864
- this._target = -1;
865
- }
866
- else {
867
- this._project = de.project;
868
- this._target = new ReflectionSymbolId(obj.target);
869
- }
870
- this.qualifiedName = obj.qualifiedName ?? obj.name;
871
- this.package = obj.package;
872
- this.refersToTypeParameter = !!obj.refersToTypeParameter;
873
- this.preferValues = !!obj.preferValues;
874
- if (obj.highlightedProperties) {
875
- this.highlightedProperties = new Map();
876
- for (const [key, parts] of Object.entries(obj.highlightedProperties)) {
877
- this.highlightedProperties.set(key, Comment.deserializeDisplayParts(de, parts));
878
925
  }
879
926
  }
880
- }
881
- }
927
+ };
928
+ })();
929
+ export { ReferenceType };
882
930
  /**
883
931
  * Represents a type which has it's own reflection like literal types.
884
932
  * This type will likely go away at some point and be replaced by a dedicated
@@ -204,6 +204,11 @@ let MarkedPlugin = (() => {
204
204
  .reflection_0_links_to_1_with_text_2_but_resolved_to_3(page.model.getFriendlyFullName(), part.target.getFriendlyFullName(), part.text, target.getFriendlyFullName()));
205
205
  }
206
206
  }
207
+ // If the url goes to this page, render as `#`
208
+ // to go to the top of the page.
209
+ if (url == "") {
210
+ url = "#";
211
+ }
207
212
  }
208
213
  if (useHtml) {
209
214
  const text = part.tag === "@linkcode" ? `<code>${part.text}</code>` : part.text;
@@ -7,6 +7,7 @@ export interface Icons extends Record<ReflectionKind, () => JSX.Element> {
7
7
  checkbox(): JSX.Element;
8
8
  menu(): JSX.Element;
9
9
  search(): JSX.Element;
10
+ /** @deprecated */
10
11
  chevronSmall(): JSX.Element;
11
12
  anchor(): JSX.Element;
12
13
  folder(): JSX.Element;
@@ -18,7 +18,7 @@ export function index(context, props) {
18
18
  JSX.createElement("section", { class: "tsd-panel tsd-index-panel" },
19
19
  JSX.createElement("details", { class: "tsd-index-content tsd-accordion", open: true },
20
20
  JSX.createElement("summary", { class: "tsd-accordion-summary tsd-index-summary" },
21
- context.icons.chevronSmall(),
21
+ context.icons.chevronDown(),
22
22
  JSX.createElement("h5", { class: "tsd-index-heading uppercase" }, i18n.theme_index())),
23
23
  JSX.createElement("div", { class: "tsd-accordion-details" }, sections.map(s => renderSection(context, s))))))));
24
24
  }
@@ -31,17 +31,14 @@ export function getKindClass(refl) {
31
31
  * @return The original string containing ``<wbr>`` tags where possible.
32
32
  */
33
33
  export function wbr(str) {
34
- // TODO surely there is a better way to do this, but I'm tired.
35
- const ret = [];
36
- const re = /[\s\S]*?(?:[^_-][_-](?=[^_-])|[^A-Z](?=[A-Z][^A-Z]))/g;
37
- let match;
38
- let i = 0;
39
- while ((match = re.exec(str))) {
40
- ret.push(match[0], JSX.createElement("wbr", null));
41
- i += match[0].length;
42
- }
43
- ret.push(str.slice(i));
44
- return ret;
34
+ // Keep this in sync with the same helper in Navigation.ts
35
+ // We use lookahead/lookbehind to indicate where the string should
36
+ // be split without consuming a character.
37
+ // (?<=[^A-Z])(?=[A-Z]) -- regular camel cased text
38
+ // (?<=[A-Z])(?=[A-Z][a-z]) -- acronym
39
+ // (?<=[_-])(?=[^_-]) -- snake
40
+ const parts = str.split(/(?<=[^A-Z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|(?<=[_-])(?=[^_-])/);
41
+ return parts.flatMap(p => [p, JSX.createElement("wbr", null)]).slice(0, -1);
45
42
  }
46
43
  export function join(joiner, list, cb) {
47
44
  const result = [];
@@ -231,9 +231,6 @@ function expandGlobs(globs, exclude, logger) {
231
231
  // #2918 - do not pass entry through nicePath here in case it contains
232
232
  // windows path separators which should cause additional warnings.
233
233
  logger.warn(i18n.glob_0_did_not_match_any_files(entry));
234
- if (entry.includes("\\") && !entry.includes("/")) {
235
- logger.info(i18n.glob_should_use_posix_slash());
236
- }
237
234
  }
238
235
  else if (filtered.length === 0) {
239
236
  logger.warn(i18n.entry_point_0_did_not_match_any_files_after_exclude(entry));
@@ -1,7 +1,8 @@
1
1
  import * as shiki from "@gerrit0/mini-shiki";
2
2
  import { JSX, unique } from "#utils";
3
3
  import assert from "assert";
4
- const aliases = new Map();
4
+ const tsAliases = [["mts", "typescript"], ["cts", "typescript"]];
5
+ const aliases = new Map(tsAliases);
5
6
  for (const lang of shiki.bundledLanguagesInfo) {
6
7
  for (const alias of lang.aliases || []) {
7
8
  aliases.set(alias, lang.id);
@@ -131,7 +132,7 @@ export function getSupportedThemes() {
131
132
  return supportedThemes;
132
133
  }
133
134
  export function isLoadedLanguage(lang) {
134
- return (plaintextLanguages.includes(lang) || ignoredLanguages?.includes(lang) || highlighter?.supports(lang) || false);
135
+ return (isSupportedLanguage(lang) || highlighter?.supports(lang) || false);
135
136
  }
136
137
  export function highlight(code, lang) {
137
138
  assert(highlighter, "Tried to highlight with an uninitialized highlighter");
@@ -199,7 +199,17 @@ const converters = {
199
199
  return resolved;
200
200
  },
201
201
  [ParameterType.GlobArray](value, option, configPath) {
202
- const toGlobString = (v) => createGlobString(configPath, String(v));
202
+ const toGlobString = (v) => {
203
+ const s = String(v);
204
+ // If the string tries to escape a character which isn't a special
205
+ // glob character, the user probably provided a Windows style path
206
+ // by accident due to shell completion, tell them to either remove
207
+ // the useless escape or switch to Unix path separators.
208
+ if (/\\[^?*()[\]\\{}]/.test(s)) {
209
+ throw new Error(i18n.glob_0_should_use_posix_slash(s));
210
+ }
211
+ return createGlobString(configPath, s);
212
+ };
203
213
  const globs = Array.isArray(value) ? value.map(toGlobString) : [toGlobString(value)];
204
214
  option.validate?.(globs);
205
215
  return globs;
@@ -8,6 +8,8 @@ export declare class ArgumentsReader implements OptionsReader {
8
8
  readonly order: number;
9
9
  readonly supportsPackages = false;
10
10
  private args;
11
+ private skipErrorReporting;
11
12
  constructor(priority: number, args?: string[]);
13
+ ignoreErrors(): this;
12
14
  read(container: Options, logger: Logger): void;
13
15
  }