@alextheman/eslint-plugin 1.2.5 → 1.2.6

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.js CHANGED
@@ -21,25 +21,7 @@ var __spreadValues = (a, b) => {
21
21
  return a;
22
22
  };
23
23
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
25
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
26
- }) : x)(function(x) {
27
- if (typeof require !== "undefined") return require.apply(this, arguments);
28
- throw Error('Dynamic require of "' + x + '" is not supported');
29
- });
30
- var __objRest = (source, exclude) => {
31
- var target = {};
32
- for (var prop in source)
33
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
34
- target[prop] = source[prop];
35
- if (source != null && __getOwnPropSymbols)
36
- for (var prop of __getOwnPropSymbols(source)) {
37
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
38
- target[prop] = source[prop];
39
- }
40
- return target;
41
- };
42
- var __commonJS = (cb, mod) => function __require2() {
24
+ var __commonJS = (cb, mod) => function __require() {
43
25
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
44
26
  };
45
27
  var __copyProps = (to, from, except, desc) => {
@@ -58,26 +40,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
58
40
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
59
41
  mod
60
42
  ));
61
- var __async = (__this, __arguments, generator) => {
62
- return new Promise((resolve, reject) => {
63
- var fulfilled = (value) => {
64
- try {
65
- step(generator.next(value));
66
- } catch (e) {
67
- reject(e);
68
- }
69
- };
70
- var rejected = (value) => {
71
- try {
72
- step(generator.throw(value));
73
- } catch (e) {
74
- reject(e);
75
- }
76
- };
77
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
78
- step((generator = generator.apply(__this, __arguments)).next());
79
- });
80
- };
81
43
 
82
44
  // node_modules/@eslint/js/package.json
83
45
  var require_package = __commonJS({
@@ -3728,2116 +3690,9 @@ var require_globals2 = __commonJS({
3728
3690
  }
3729
3691
  });
3730
3692
 
3731
- // node_modules/eslint-config-prettier/index.js
3732
- var require_eslint_config_prettier = __commonJS({
3733
- "node_modules/eslint-config-prettier/index.js"(exports) {
3734
- "use strict";
3735
- var includeDeprecated = !process.env.ESLINT_CONFIG_PRETTIER_NO_DEPRECATED;
3736
- var specialRule = 0;
3737
- exports.rules = __spreadValues({
3738
- // The following rules can be used in some cases. See the README for more
3739
- // information. These are marked with `0` instead of `"off"` so that a
3740
- // script can distinguish them. Note that there are a few more of these
3741
- // in the deprecated section below.
3742
- "curly": specialRule,
3743
- "no-unexpected-multiline": specialRule,
3744
- "@stylistic/lines-around-comment": specialRule,
3745
- "@stylistic/max-len": specialRule,
3746
- "@stylistic/no-confusing-arrow": specialRule,
3747
- "@stylistic/no-mixed-operators": specialRule,
3748
- "@stylistic/no-tabs": specialRule,
3749
- "@stylistic/quotes": specialRule,
3750
- "@stylistic/js/lines-around-comment": specialRule,
3751
- "@stylistic/js/max-len": specialRule,
3752
- "@stylistic/js/no-confusing-arrow": specialRule,
3753
- "@stylistic/js/no-mixed-operators": specialRule,
3754
- "@stylistic/js/no-tabs": specialRule,
3755
- "@stylistic/js/quotes": specialRule,
3756
- "@stylistic/ts/lines-around-comment": specialRule,
3757
- "@stylistic/ts/quotes": specialRule,
3758
- "@typescript-eslint/lines-around-comment": specialRule,
3759
- "@typescript-eslint/quotes": specialRule,
3760
- "babel/quotes": specialRule,
3761
- "unicorn/template-indent": specialRule,
3762
- "vue/html-self-closing": specialRule,
3763
- "vue/max-len": specialRule,
3764
- // The rest are rules that you never need to enable when using Prettier.
3765
- "@babel/object-curly-spacing": "off",
3766
- "@babel/semi": "off",
3767
- "@stylistic/array-bracket-newline": "off",
3768
- "@stylistic/array-bracket-spacing": "off",
3769
- "@stylistic/array-element-newline": "off",
3770
- "@stylistic/arrow-parens": "off",
3771
- "@stylistic/arrow-spacing": "off",
3772
- "@stylistic/block-spacing": "off",
3773
- "@stylistic/brace-style": "off",
3774
- "@stylistic/comma-dangle": "off",
3775
- "@stylistic/comma-spacing": "off",
3776
- "@stylistic/comma-style": "off",
3777
- "@stylistic/computed-property-spacing": "off",
3778
- "@stylistic/dot-location": "off",
3779
- "@stylistic/eol-last": "off",
3780
- "@stylistic/func-call-spacing": "off",
3781
- "@stylistic/function-call-argument-newline": "off",
3782
- "@stylistic/function-call-spacing": "off",
3783
- "@stylistic/function-paren-newline": "off",
3784
- "@stylistic/generator-star-spacing": "off",
3785
- "@stylistic/implicit-arrow-linebreak": "off",
3786
- "@stylistic/indent": "off",
3787
- "@stylistic/jsx-quotes": "off",
3788
- "@stylistic/key-spacing": "off",
3789
- "@stylistic/keyword-spacing": "off",
3790
- "@stylistic/linebreak-style": "off",
3791
- "@stylistic/max-statements-per-line": "off",
3792
- "@stylistic/multiline-ternary": "off",
3793
- "@stylistic/new-parens": "off",
3794
- "@stylistic/newline-per-chained-call": "off",
3795
- "@stylistic/no-extra-parens": "off",
3796
- "@stylistic/no-extra-semi": "off",
3797
- "@stylistic/no-floating-decimal": "off",
3798
- "@stylistic/no-mixed-spaces-and-tabs": "off",
3799
- "@stylistic/no-multi-spaces": "off",
3800
- "@stylistic/no-multiple-empty-lines": "off",
3801
- "@stylistic/no-trailing-spaces": "off",
3802
- "@stylistic/no-whitespace-before-property": "off",
3803
- "@stylistic/nonblock-statement-body-position": "off",
3804
- "@stylistic/object-curly-newline": "off",
3805
- "@stylistic/object-curly-spacing": "off",
3806
- "@stylistic/object-property-newline": "off",
3807
- "@stylistic/one-var-declaration-per-line": "off",
3808
- "@stylistic/operator-linebreak": "off",
3809
- "@stylistic/padded-blocks": "off",
3810
- "@stylistic/quote-props": "off",
3811
- "@stylistic/rest-spread-spacing": "off",
3812
- "@stylistic/semi": "off",
3813
- "@stylistic/semi-spacing": "off",
3814
- "@stylistic/semi-style": "off",
3815
- "@stylistic/space-before-blocks": "off",
3816
- "@stylistic/space-before-function-paren": "off",
3817
- "@stylistic/space-in-parens": "off",
3818
- "@stylistic/space-infix-ops": "off",
3819
- "@stylistic/space-unary-ops": "off",
3820
- "@stylistic/switch-colon-spacing": "off",
3821
- "@stylistic/template-curly-spacing": "off",
3822
- "@stylistic/template-tag-spacing": "off",
3823
- "@stylistic/wrap-iife": "off",
3824
- "@stylistic/wrap-regex": "off",
3825
- "@stylistic/yield-star-spacing": "off",
3826
- "@stylistic/member-delimiter-style": "off",
3827
- "@stylistic/type-annotation-spacing": "off",
3828
- "@stylistic/jsx-child-element-spacing": "off",
3829
- "@stylistic/jsx-closing-bracket-location": "off",
3830
- "@stylistic/jsx-closing-tag-location": "off",
3831
- "@stylistic/jsx-curly-newline": "off",
3832
- "@stylistic/jsx-curly-spacing": "off",
3833
- "@stylistic/jsx-equals-spacing": "off",
3834
- "@stylistic/jsx-first-prop-new-line": "off",
3835
- "@stylistic/jsx-indent": "off",
3836
- "@stylistic/jsx-indent-props": "off",
3837
- "@stylistic/jsx-max-props-per-line": "off",
3838
- "@stylistic/jsx-newline": "off",
3839
- "@stylistic/jsx-one-expression-per-line": "off",
3840
- "@stylistic/jsx-props-no-multi-spaces": "off",
3841
- "@stylistic/jsx-tag-spacing": "off",
3842
- "@stylistic/jsx-wrap-multilines": "off",
3843
- "@stylistic/indent-binary-ops": "off",
3844
- "@stylistic/type-generic-spacing": "off",
3845
- "@stylistic/type-named-tuple-spacing": "off",
3846
- "@stylistic/js/array-bracket-newline": "off",
3847
- "@stylistic/js/array-bracket-spacing": "off",
3848
- "@stylistic/js/array-element-newline": "off",
3849
- "@stylistic/js/arrow-parens": "off",
3850
- "@stylistic/js/arrow-spacing": "off",
3851
- "@stylistic/js/block-spacing": "off",
3852
- "@stylistic/js/brace-style": "off",
3853
- "@stylistic/js/comma-dangle": "off",
3854
- "@stylistic/js/comma-spacing": "off",
3855
- "@stylistic/js/comma-style": "off",
3856
- "@stylistic/js/computed-property-spacing": "off",
3857
- "@stylistic/js/dot-location": "off",
3858
- "@stylistic/js/eol-last": "off",
3859
- "@stylistic/js/func-call-spacing": "off",
3860
- "@stylistic/js/function-call-argument-newline": "off",
3861
- "@stylistic/js/function-call-spacing": "off",
3862
- "@stylistic/js/function-paren-newline": "off",
3863
- "@stylistic/js/generator-star-spacing": "off",
3864
- "@stylistic/js/implicit-arrow-linebreak": "off",
3865
- "@stylistic/js/indent": "off",
3866
- "@stylistic/js/jsx-quotes": "off",
3867
- "@stylistic/js/key-spacing": "off",
3868
- "@stylistic/js/keyword-spacing": "off",
3869
- "@stylistic/js/linebreak-style": "off",
3870
- "@stylistic/js/max-statements-per-line": "off",
3871
- "@stylistic/js/multiline-ternary": "off",
3872
- "@stylistic/js/new-parens": "off",
3873
- "@stylistic/js/newline-per-chained-call": "off",
3874
- "@stylistic/js/no-extra-parens": "off",
3875
- "@stylistic/js/no-extra-semi": "off",
3876
- "@stylistic/js/no-floating-decimal": "off",
3877
- "@stylistic/js/no-mixed-spaces-and-tabs": "off",
3878
- "@stylistic/js/no-multi-spaces": "off",
3879
- "@stylistic/js/no-multiple-empty-lines": "off",
3880
- "@stylistic/js/no-trailing-spaces": "off",
3881
- "@stylistic/js/no-whitespace-before-property": "off",
3882
- "@stylistic/js/nonblock-statement-body-position": "off",
3883
- "@stylistic/js/object-curly-newline": "off",
3884
- "@stylistic/js/object-curly-spacing": "off",
3885
- "@stylistic/js/object-property-newline": "off",
3886
- "@stylistic/js/one-var-declaration-per-line": "off",
3887
- "@stylistic/js/operator-linebreak": "off",
3888
- "@stylistic/js/padded-blocks": "off",
3889
- "@stylistic/js/quote-props": "off",
3890
- "@stylistic/js/rest-spread-spacing": "off",
3891
- "@stylistic/js/semi": "off",
3892
- "@stylistic/js/semi-spacing": "off",
3893
- "@stylistic/js/semi-style": "off",
3894
- "@stylistic/js/space-before-blocks": "off",
3895
- "@stylistic/js/space-before-function-paren": "off",
3896
- "@stylistic/js/space-in-parens": "off",
3897
- "@stylistic/js/space-infix-ops": "off",
3898
- "@stylistic/js/space-unary-ops": "off",
3899
- "@stylistic/js/switch-colon-spacing": "off",
3900
- "@stylistic/js/template-curly-spacing": "off",
3901
- "@stylistic/js/template-tag-spacing": "off",
3902
- "@stylistic/js/wrap-iife": "off",
3903
- "@stylistic/js/wrap-regex": "off",
3904
- "@stylistic/js/yield-star-spacing": "off",
3905
- "@stylistic/ts/block-spacing": "off",
3906
- "@stylistic/ts/brace-style": "off",
3907
- "@stylistic/ts/comma-dangle": "off",
3908
- "@stylistic/ts/comma-spacing": "off",
3909
- "@stylistic/ts/func-call-spacing": "off",
3910
- "@stylistic/ts/function-call-spacing": "off",
3911
- "@stylistic/ts/indent": "off",
3912
- "@stylistic/ts/key-spacing": "off",
3913
- "@stylistic/ts/keyword-spacing": "off",
3914
- "@stylistic/ts/member-delimiter-style": "off",
3915
- "@stylistic/ts/no-extra-parens": "off",
3916
- "@stylistic/ts/no-extra-semi": "off",
3917
- "@stylistic/ts/object-curly-spacing": "off",
3918
- "@stylistic/ts/semi": "off",
3919
- "@stylistic/ts/space-before-blocks": "off",
3920
- "@stylistic/ts/space-before-function-paren": "off",
3921
- "@stylistic/ts/space-infix-ops": "off",
3922
- "@stylistic/ts/type-annotation-spacing": "off",
3923
- "@stylistic/jsx/jsx-child-element-spacing": "off",
3924
- "@stylistic/jsx/jsx-closing-bracket-location": "off",
3925
- "@stylistic/jsx/jsx-closing-tag-location": "off",
3926
- "@stylistic/jsx/jsx-curly-newline": "off",
3927
- "@stylistic/jsx/jsx-curly-spacing": "off",
3928
- "@stylistic/jsx/jsx-equals-spacing": "off",
3929
- "@stylistic/jsx/jsx-first-prop-new-line": "off",
3930
- "@stylistic/jsx/jsx-indent": "off",
3931
- "@stylistic/jsx/jsx-indent-props": "off",
3932
- "@stylistic/jsx/jsx-max-props-per-line": "off",
3933
- "@typescript-eslint/block-spacing": "off",
3934
- "@typescript-eslint/brace-style": "off",
3935
- "@typescript-eslint/comma-dangle": "off",
3936
- "@typescript-eslint/comma-spacing": "off",
3937
- "@typescript-eslint/func-call-spacing": "off",
3938
- "@typescript-eslint/indent": "off",
3939
- "@typescript-eslint/key-spacing": "off",
3940
- "@typescript-eslint/keyword-spacing": "off",
3941
- "@typescript-eslint/member-delimiter-style": "off",
3942
- "@typescript-eslint/no-extra-parens": "off",
3943
- "@typescript-eslint/no-extra-semi": "off",
3944
- "@typescript-eslint/object-curly-spacing": "off",
3945
- "@typescript-eslint/semi": "off",
3946
- "@typescript-eslint/space-before-blocks": "off",
3947
- "@typescript-eslint/space-before-function-paren": "off",
3948
- "@typescript-eslint/space-infix-ops": "off",
3949
- "@typescript-eslint/type-annotation-spacing": "off",
3950
- "babel/object-curly-spacing": "off",
3951
- "babel/semi": "off",
3952
- "flowtype/boolean-style": "off",
3953
- "flowtype/delimiter-dangle": "off",
3954
- "flowtype/generic-spacing": "off",
3955
- "flowtype/object-type-curly-spacing": "off",
3956
- "flowtype/object-type-delimiter": "off",
3957
- "flowtype/quotes": "off",
3958
- "flowtype/semi": "off",
3959
- "flowtype/space-after-type-colon": "off",
3960
- "flowtype/space-before-generic-bracket": "off",
3961
- "flowtype/space-before-type-colon": "off",
3962
- "flowtype/union-intersection-spacing": "off",
3963
- "react/jsx-child-element-spacing": "off",
3964
- "react/jsx-closing-bracket-location": "off",
3965
- "react/jsx-closing-tag-location": "off",
3966
- "react/jsx-curly-newline": "off",
3967
- "react/jsx-curly-spacing": "off",
3968
- "react/jsx-equals-spacing": "off",
3969
- "react/jsx-first-prop-new-line": "off",
3970
- "react/jsx-indent": "off",
3971
- "react/jsx-indent-props": "off",
3972
- "react/jsx-max-props-per-line": "off",
3973
- "react/jsx-newline": "off",
3974
- "react/jsx-one-expression-per-line": "off",
3975
- "react/jsx-props-no-multi-spaces": "off",
3976
- "react/jsx-tag-spacing": "off",
3977
- "react/jsx-wrap-multilines": "off",
3978
- "standard/array-bracket-even-spacing": "off",
3979
- "standard/computed-property-even-spacing": "off",
3980
- "standard/object-curly-even-spacing": "off",
3981
- "unicorn/empty-brace-spaces": "off",
3982
- "unicorn/no-nested-ternary": "off",
3983
- "unicorn/number-literal-case": "off",
3984
- "vue/array-bracket-newline": "off",
3985
- "vue/array-bracket-spacing": "off",
3986
- "vue/array-element-newline": "off",
3987
- "vue/arrow-spacing": "off",
3988
- "vue/block-spacing": "off",
3989
- "vue/block-tag-newline": "off",
3990
- "vue/brace-style": "off",
3991
- "vue/comma-dangle": "off",
3992
- "vue/comma-spacing": "off",
3993
- "vue/comma-style": "off",
3994
- "vue/dot-location": "off",
3995
- "vue/func-call-spacing": "off",
3996
- "vue/html-closing-bracket-newline": "off",
3997
- "vue/html-closing-bracket-spacing": "off",
3998
- "vue/html-end-tags": "off",
3999
- "vue/html-indent": "off",
4000
- "vue/html-quotes": "off",
4001
- "vue/key-spacing": "off",
4002
- "vue/keyword-spacing": "off",
4003
- "vue/max-attributes-per-line": "off",
4004
- "vue/multiline-html-element-content-newline": "off",
4005
- "vue/multiline-ternary": "off",
4006
- "vue/mustache-interpolation-spacing": "off",
4007
- "vue/no-extra-parens": "off",
4008
- "vue/no-multi-spaces": "off",
4009
- "vue/no-spaces-around-equal-signs-in-attribute": "off",
4010
- "vue/object-curly-newline": "off",
4011
- "vue/object-curly-spacing": "off",
4012
- "vue/object-property-newline": "off",
4013
- "vue/operator-linebreak": "off",
4014
- "vue/quote-props": "off",
4015
- "vue/script-indent": "off",
4016
- "vue/singleline-html-element-content-newline": "off",
4017
- "vue/space-in-parens": "off",
4018
- "vue/space-infix-ops": "off",
4019
- "vue/space-unary-ops": "off",
4020
- "vue/template-curly-spacing": "off"
4021
- }, includeDeprecated && {
4022
- // Removed in version 0.10.0.
4023
- // https://eslint.org/docs/latest/rules/space-unary-word-ops
4024
- "space-unary-word-ops": "off",
4025
- // Removed in version 1.0.0.
4026
- // https://github.com/eslint/eslint/issues/1898
4027
- "generator-star": "off",
4028
- "no-comma-dangle": "off",
4029
- "no-reserved-keys": "off",
4030
- "no-space-before-semi": "off",
4031
- "no-wrap-func": "off",
4032
- "space-after-function-name": "off",
4033
- "space-before-function-parentheses": "off",
4034
- "space-in-brackets": "off",
4035
- // Removed in version 2.0.0.
4036
- // https://github.com/eslint/eslint/issues/5032
4037
- "no-arrow-condition": "off",
4038
- "space-after-keywords": "off",
4039
- "space-before-keywords": "off",
4040
- "space-return-throw-case": "off",
4041
- // Deprecated since version 3.3.0.
4042
- // https://eslint.org/docs/rules/no-spaced-func
4043
- "no-spaced-func": "off",
4044
- // Deprecated since version 4.0.0.
4045
- // https://github.com/eslint/eslint/pull/8286
4046
- "indent-legacy": "off",
4047
- // Deprecated since version 8.53.0.
4048
- // https://eslint.org/blog/2023/10/deprecating-formatting-rules/
4049
- "array-bracket-newline": "off",
4050
- "array-bracket-spacing": "off",
4051
- "array-element-newline": "off",
4052
- "arrow-parens": "off",
4053
- "arrow-spacing": "off",
4054
- "block-spacing": "off",
4055
- "brace-style": "off",
4056
- "comma-dangle": "off",
4057
- "comma-spacing": "off",
4058
- "comma-style": "off",
4059
- "computed-property-spacing": "off",
4060
- "dot-location": "off",
4061
- "eol-last": "off",
4062
- "func-call-spacing": "off",
4063
- "function-call-argument-newline": "off",
4064
- "function-paren-newline": "off",
4065
- "generator-star-spacing": "off",
4066
- "implicit-arrow-linebreak": "off",
4067
- "indent": "off",
4068
- "jsx-quotes": "off",
4069
- "key-spacing": "off",
4070
- "keyword-spacing": "off",
4071
- "linebreak-style": "off",
4072
- "lines-around-comment": specialRule,
4073
- "max-len": specialRule,
4074
- "max-statements-per-line": "off",
4075
- "multiline-ternary": "off",
4076
- "new-parens": "off",
4077
- "newline-per-chained-call": "off",
4078
- "no-confusing-arrow": specialRule,
4079
- "no-extra-parens": "off",
4080
- "no-extra-semi": "off",
4081
- "no-floating-decimal": "off",
4082
- "no-mixed-operators": specialRule,
4083
- "no-mixed-spaces-and-tabs": "off",
4084
- "no-multi-spaces": "off",
4085
- "no-multiple-empty-lines": "off",
4086
- "no-tabs": specialRule,
4087
- "no-trailing-spaces": "off",
4088
- "no-whitespace-before-property": "off",
4089
- "nonblock-statement-body-position": "off",
4090
- "object-curly-newline": "off",
4091
- "object-curly-spacing": "off",
4092
- "object-property-newline": "off",
4093
- "one-var-declaration-per-line": "off",
4094
- "operator-linebreak": "off",
4095
- "padded-blocks": "off",
4096
- "quote-props": "off",
4097
- "quotes": specialRule,
4098
- "rest-spread-spacing": "off",
4099
- "semi": "off",
4100
- "semi-spacing": "off",
4101
- "semi-style": "off",
4102
- "space-before-blocks": "off",
4103
- "space-before-function-paren": "off",
4104
- "space-in-parens": "off",
4105
- "space-infix-ops": "off",
4106
- "space-unary-ops": "off",
4107
- "switch-colon-spacing": "off",
4108
- "template-curly-spacing": "off",
4109
- "template-tag-spacing": "off",
4110
- "wrap-iife": "off",
4111
- "wrap-regex": "off",
4112
- "yield-star-spacing": "off",
4113
- // Deprecated since version 7.0.0.
4114
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md#700---2017-05-06
4115
- "react/jsx-space-before-closing": "off"
4116
- });
4117
- }
4118
- });
4119
-
4120
- // node_modules/fast-diff/diff.js
4121
- var require_diff = __commonJS({
4122
- "node_modules/fast-diff/diff.js"(exports, module) {
4123
- "use strict";
4124
- var DIFF_DELETE = -1;
4125
- var DIFF_INSERT = 1;
4126
- var DIFF_EQUAL = 0;
4127
- function diff_main(text1, text2, cursor_pos, cleanup, _fix_unicode) {
4128
- if (text1 === text2) {
4129
- if (text1) {
4130
- return [[DIFF_EQUAL, text1]];
4131
- }
4132
- return [];
4133
- }
4134
- if (cursor_pos != null) {
4135
- var editdiff = find_cursor_edit_diff(text1, text2, cursor_pos);
4136
- if (editdiff) {
4137
- return editdiff;
4138
- }
4139
- }
4140
- var commonlength = diff_commonPrefix(text1, text2);
4141
- var commonprefix = text1.substring(0, commonlength);
4142
- text1 = text1.substring(commonlength);
4143
- text2 = text2.substring(commonlength);
4144
- commonlength = diff_commonSuffix(text1, text2);
4145
- var commonsuffix = text1.substring(text1.length - commonlength);
4146
- text1 = text1.substring(0, text1.length - commonlength);
4147
- text2 = text2.substring(0, text2.length - commonlength);
4148
- var diffs = diff_compute_(text1, text2);
4149
- if (commonprefix) {
4150
- diffs.unshift([DIFF_EQUAL, commonprefix]);
4151
- }
4152
- if (commonsuffix) {
4153
- diffs.push([DIFF_EQUAL, commonsuffix]);
4154
- }
4155
- diff_cleanupMerge(diffs, _fix_unicode);
4156
- if (cleanup) {
4157
- diff_cleanupSemantic(diffs);
4158
- }
4159
- return diffs;
4160
- }
4161
- function diff_compute_(text1, text2) {
4162
- var diffs;
4163
- if (!text1) {
4164
- return [[DIFF_INSERT, text2]];
4165
- }
4166
- if (!text2) {
4167
- return [[DIFF_DELETE, text1]];
4168
- }
4169
- var longtext = text1.length > text2.length ? text1 : text2;
4170
- var shorttext = text1.length > text2.length ? text2 : text1;
4171
- var i = longtext.indexOf(shorttext);
4172
- if (i !== -1) {
4173
- diffs = [
4174
- [DIFF_INSERT, longtext.substring(0, i)],
4175
- [DIFF_EQUAL, shorttext],
4176
- [DIFF_INSERT, longtext.substring(i + shorttext.length)]
4177
- ];
4178
- if (text1.length > text2.length) {
4179
- diffs[0][0] = diffs[2][0] = DIFF_DELETE;
4180
- }
4181
- return diffs;
4182
- }
4183
- if (shorttext.length === 1) {
4184
- return [
4185
- [DIFF_DELETE, text1],
4186
- [DIFF_INSERT, text2]
4187
- ];
4188
- }
4189
- var hm = diff_halfMatch_(text1, text2);
4190
- if (hm) {
4191
- var text1_a = hm[0];
4192
- var text1_b = hm[1];
4193
- var text2_a = hm[2];
4194
- var text2_b = hm[3];
4195
- var mid_common = hm[4];
4196
- var diffs_a = diff_main(text1_a, text2_a);
4197
- var diffs_b = diff_main(text1_b, text2_b);
4198
- return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);
4199
- }
4200
- return diff_bisect_(text1, text2);
4201
- }
4202
- function diff_bisect_(text1, text2) {
4203
- var text1_length = text1.length;
4204
- var text2_length = text2.length;
4205
- var max_d = Math.ceil((text1_length + text2_length) / 2);
4206
- var v_offset = max_d;
4207
- var v_length = 2 * max_d;
4208
- var v1 = new Array(v_length);
4209
- var v2 = new Array(v_length);
4210
- for (var x = 0; x < v_length; x++) {
4211
- v1[x] = -1;
4212
- v2[x] = -1;
4213
- }
4214
- v1[v_offset + 1] = 0;
4215
- v2[v_offset + 1] = 0;
4216
- var delta = text1_length - text2_length;
4217
- var front = delta % 2 !== 0;
4218
- var k1start = 0;
4219
- var k1end = 0;
4220
- var k2start = 0;
4221
- var k2end = 0;
4222
- for (var d = 0; d < max_d; d++) {
4223
- for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {
4224
- var k1_offset = v_offset + k1;
4225
- var x1;
4226
- if (k1 === -d || k1 !== d && v1[k1_offset - 1] < v1[k1_offset + 1]) {
4227
- x1 = v1[k1_offset + 1];
4228
- } else {
4229
- x1 = v1[k1_offset - 1] + 1;
4230
- }
4231
- var y1 = x1 - k1;
4232
- while (x1 < text1_length && y1 < text2_length && text1.charAt(x1) === text2.charAt(y1)) {
4233
- x1++;
4234
- y1++;
4235
- }
4236
- v1[k1_offset] = x1;
4237
- if (x1 > text1_length) {
4238
- k1end += 2;
4239
- } else if (y1 > text2_length) {
4240
- k1start += 2;
4241
- } else if (front) {
4242
- var k2_offset = v_offset + delta - k1;
4243
- if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] !== -1) {
4244
- var x2 = text1_length - v2[k2_offset];
4245
- if (x1 >= x2) {
4246
- return diff_bisectSplit_(text1, text2, x1, y1);
4247
- }
4248
- }
4249
- }
4250
- }
4251
- for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {
4252
- var k2_offset = v_offset + k2;
4253
- var x2;
4254
- if (k2 === -d || k2 !== d && v2[k2_offset - 1] < v2[k2_offset + 1]) {
4255
- x2 = v2[k2_offset + 1];
4256
- } else {
4257
- x2 = v2[k2_offset - 1] + 1;
4258
- }
4259
- var y2 = x2 - k2;
4260
- while (x2 < text1_length && y2 < text2_length && text1.charAt(text1_length - x2 - 1) === text2.charAt(text2_length - y2 - 1)) {
4261
- x2++;
4262
- y2++;
4263
- }
4264
- v2[k2_offset] = x2;
4265
- if (x2 > text1_length) {
4266
- k2end += 2;
4267
- } else if (y2 > text2_length) {
4268
- k2start += 2;
4269
- } else if (!front) {
4270
- var k1_offset = v_offset + delta - k2;
4271
- if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] !== -1) {
4272
- var x1 = v1[k1_offset];
4273
- var y1 = v_offset + x1 - k1_offset;
4274
- x2 = text1_length - x2;
4275
- if (x1 >= x2) {
4276
- return diff_bisectSplit_(text1, text2, x1, y1);
4277
- }
4278
- }
4279
- }
4280
- }
4281
- }
4282
- return [
4283
- [DIFF_DELETE, text1],
4284
- [DIFF_INSERT, text2]
4285
- ];
4286
- }
4287
- function diff_bisectSplit_(text1, text2, x, y) {
4288
- var text1a = text1.substring(0, x);
4289
- var text2a = text2.substring(0, y);
4290
- var text1b = text1.substring(x);
4291
- var text2b = text2.substring(y);
4292
- var diffs = diff_main(text1a, text2a);
4293
- var diffsb = diff_main(text1b, text2b);
4294
- return diffs.concat(diffsb);
4295
- }
4296
- function diff_commonPrefix(text1, text2) {
4297
- if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) {
4298
- return 0;
4299
- }
4300
- var pointermin = 0;
4301
- var pointermax = Math.min(text1.length, text2.length);
4302
- var pointermid = pointermax;
4303
- var pointerstart = 0;
4304
- while (pointermin < pointermid) {
4305
- if (text1.substring(pointerstart, pointermid) == text2.substring(pointerstart, pointermid)) {
4306
- pointermin = pointermid;
4307
- pointerstart = pointermin;
4308
- } else {
4309
- pointermax = pointermid;
4310
- }
4311
- pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
4312
- }
4313
- if (is_surrogate_pair_start(text1.charCodeAt(pointermid - 1))) {
4314
- pointermid--;
4315
- }
4316
- return pointermid;
4317
- }
4318
- function diff_commonOverlap_(text1, text2) {
4319
- var text1_length = text1.length;
4320
- var text2_length = text2.length;
4321
- if (text1_length == 0 || text2_length == 0) {
4322
- return 0;
4323
- }
4324
- if (text1_length > text2_length) {
4325
- text1 = text1.substring(text1_length - text2_length);
4326
- } else if (text1_length < text2_length) {
4327
- text2 = text2.substring(0, text1_length);
4328
- }
4329
- var text_length = Math.min(text1_length, text2_length);
4330
- if (text1 == text2) {
4331
- return text_length;
4332
- }
4333
- var best = 0;
4334
- var length = 1;
4335
- while (true) {
4336
- var pattern = text1.substring(text_length - length);
4337
- var found = text2.indexOf(pattern);
4338
- if (found == -1) {
4339
- return best;
4340
- }
4341
- length += found;
4342
- if (found == 0 || text1.substring(text_length - length) == text2.substring(0, length)) {
4343
- best = length;
4344
- length++;
4345
- }
4346
- }
4347
- }
4348
- function diff_commonSuffix(text1, text2) {
4349
- if (!text1 || !text2 || text1.slice(-1) !== text2.slice(-1)) {
4350
- return 0;
4351
- }
4352
- var pointermin = 0;
4353
- var pointermax = Math.min(text1.length, text2.length);
4354
- var pointermid = pointermax;
4355
- var pointerend = 0;
4356
- while (pointermin < pointermid) {
4357
- if (text1.substring(text1.length - pointermid, text1.length - pointerend) == text2.substring(text2.length - pointermid, text2.length - pointerend)) {
4358
- pointermin = pointermid;
4359
- pointerend = pointermin;
4360
- } else {
4361
- pointermax = pointermid;
4362
- }
4363
- pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
4364
- }
4365
- if (is_surrogate_pair_end(text1.charCodeAt(text1.length - pointermid))) {
4366
- pointermid--;
4367
- }
4368
- return pointermid;
4369
- }
4370
- function diff_halfMatch_(text1, text2) {
4371
- var longtext = text1.length > text2.length ? text1 : text2;
4372
- var shorttext = text1.length > text2.length ? text2 : text1;
4373
- if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
4374
- return null;
4375
- }
4376
- function diff_halfMatchI_(longtext2, shorttext2, i) {
4377
- var seed = longtext2.substring(i, i + Math.floor(longtext2.length / 4));
4378
- var j = -1;
4379
- var best_common = "";
4380
- var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
4381
- while ((j = shorttext2.indexOf(seed, j + 1)) !== -1) {
4382
- var prefixLength = diff_commonPrefix(
4383
- longtext2.substring(i),
4384
- shorttext2.substring(j)
4385
- );
4386
- var suffixLength = diff_commonSuffix(
4387
- longtext2.substring(0, i),
4388
- shorttext2.substring(0, j)
4389
- );
4390
- if (best_common.length < suffixLength + prefixLength) {
4391
- best_common = shorttext2.substring(j - suffixLength, j) + shorttext2.substring(j, j + prefixLength);
4392
- best_longtext_a = longtext2.substring(0, i - suffixLength);
4393
- best_longtext_b = longtext2.substring(i + prefixLength);
4394
- best_shorttext_a = shorttext2.substring(0, j - suffixLength);
4395
- best_shorttext_b = shorttext2.substring(j + prefixLength);
4396
- }
4397
- }
4398
- if (best_common.length * 2 >= longtext2.length) {
4399
- return [
4400
- best_longtext_a,
4401
- best_longtext_b,
4402
- best_shorttext_a,
4403
- best_shorttext_b,
4404
- best_common
4405
- ];
4406
- } else {
4407
- return null;
4408
- }
4409
- }
4410
- var hm1 = diff_halfMatchI_(
4411
- longtext,
4412
- shorttext,
4413
- Math.ceil(longtext.length / 4)
4414
- );
4415
- var hm2 = diff_halfMatchI_(
4416
- longtext,
4417
- shorttext,
4418
- Math.ceil(longtext.length / 2)
4419
- );
4420
- var hm;
4421
- if (!hm1 && !hm2) {
4422
- return null;
4423
- } else if (!hm2) {
4424
- hm = hm1;
4425
- } else if (!hm1) {
4426
- hm = hm2;
4427
- } else {
4428
- hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
4429
- }
4430
- var text1_a, text1_b, text2_a, text2_b;
4431
- if (text1.length > text2.length) {
4432
- text1_a = hm[0];
4433
- text1_b = hm[1];
4434
- text2_a = hm[2];
4435
- text2_b = hm[3];
4436
- } else {
4437
- text2_a = hm[0];
4438
- text2_b = hm[1];
4439
- text1_a = hm[2];
4440
- text1_b = hm[3];
4441
- }
4442
- var mid_common = hm[4];
4443
- return [text1_a, text1_b, text2_a, text2_b, mid_common];
4444
- }
4445
- function diff_cleanupSemantic(diffs) {
4446
- var changes = false;
4447
- var equalities = [];
4448
- var equalitiesLength = 0;
4449
- var lastequality = null;
4450
- var pointer = 0;
4451
- var length_insertions1 = 0;
4452
- var length_deletions1 = 0;
4453
- var length_insertions2 = 0;
4454
- var length_deletions2 = 0;
4455
- while (pointer < diffs.length) {
4456
- if (diffs[pointer][0] == DIFF_EQUAL) {
4457
- equalities[equalitiesLength++] = pointer;
4458
- length_insertions1 = length_insertions2;
4459
- length_deletions1 = length_deletions2;
4460
- length_insertions2 = 0;
4461
- length_deletions2 = 0;
4462
- lastequality = diffs[pointer][1];
4463
- } else {
4464
- if (diffs[pointer][0] == DIFF_INSERT) {
4465
- length_insertions2 += diffs[pointer][1].length;
4466
- } else {
4467
- length_deletions2 += diffs[pointer][1].length;
4468
- }
4469
- if (lastequality && lastequality.length <= Math.max(length_insertions1, length_deletions1) && lastequality.length <= Math.max(length_insertions2, length_deletions2)) {
4470
- diffs.splice(equalities[equalitiesLength - 1], 0, [
4471
- DIFF_DELETE,
4472
- lastequality
4473
- ]);
4474
- diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
4475
- equalitiesLength--;
4476
- equalitiesLength--;
4477
- pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
4478
- length_insertions1 = 0;
4479
- length_deletions1 = 0;
4480
- length_insertions2 = 0;
4481
- length_deletions2 = 0;
4482
- lastequality = null;
4483
- changes = true;
4484
- }
4485
- }
4486
- pointer++;
4487
- }
4488
- if (changes) {
4489
- diff_cleanupMerge(diffs);
4490
- }
4491
- diff_cleanupSemanticLossless(diffs);
4492
- pointer = 1;
4493
- while (pointer < diffs.length) {
4494
- if (diffs[pointer - 1][0] == DIFF_DELETE && diffs[pointer][0] == DIFF_INSERT) {
4495
- var deletion = diffs[pointer - 1][1];
4496
- var insertion = diffs[pointer][1];
4497
- var overlap_length1 = diff_commonOverlap_(deletion, insertion);
4498
- var overlap_length2 = diff_commonOverlap_(insertion, deletion);
4499
- if (overlap_length1 >= overlap_length2) {
4500
- if (overlap_length1 >= deletion.length / 2 || overlap_length1 >= insertion.length / 2) {
4501
- diffs.splice(pointer, 0, [
4502
- DIFF_EQUAL,
4503
- insertion.substring(0, overlap_length1)
4504
- ]);
4505
- diffs[pointer - 1][1] = deletion.substring(
4506
- 0,
4507
- deletion.length - overlap_length1
4508
- );
4509
- diffs[pointer + 1][1] = insertion.substring(overlap_length1);
4510
- pointer++;
4511
- }
4512
- } else {
4513
- if (overlap_length2 >= deletion.length / 2 || overlap_length2 >= insertion.length / 2) {
4514
- diffs.splice(pointer, 0, [
4515
- DIFF_EQUAL,
4516
- deletion.substring(0, overlap_length2)
4517
- ]);
4518
- diffs[pointer - 1][0] = DIFF_INSERT;
4519
- diffs[pointer - 1][1] = insertion.substring(
4520
- 0,
4521
- insertion.length - overlap_length2
4522
- );
4523
- diffs[pointer + 1][0] = DIFF_DELETE;
4524
- diffs[pointer + 1][1] = deletion.substring(overlap_length2);
4525
- pointer++;
4526
- }
4527
- }
4528
- pointer++;
4529
- }
4530
- pointer++;
4531
- }
4532
- }
4533
- var nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/;
4534
- var whitespaceRegex_ = /\s/;
4535
- var linebreakRegex_ = /[\r\n]/;
4536
- var blanklineEndRegex_ = /\n\r?\n$/;
4537
- var blanklineStartRegex_ = /^\r?\n\r?\n/;
4538
- function diff_cleanupSemanticLossless(diffs) {
4539
- function diff_cleanupSemanticScore_(one, two) {
4540
- if (!one || !two) {
4541
- return 6;
4542
- }
4543
- var char1 = one.charAt(one.length - 1);
4544
- var char2 = two.charAt(0);
4545
- var nonAlphaNumeric1 = char1.match(nonAlphaNumericRegex_);
4546
- var nonAlphaNumeric2 = char2.match(nonAlphaNumericRegex_);
4547
- var whitespace1 = nonAlphaNumeric1 && char1.match(whitespaceRegex_);
4548
- var whitespace2 = nonAlphaNumeric2 && char2.match(whitespaceRegex_);
4549
- var lineBreak1 = whitespace1 && char1.match(linebreakRegex_);
4550
- var lineBreak2 = whitespace2 && char2.match(linebreakRegex_);
4551
- var blankLine1 = lineBreak1 && one.match(blanklineEndRegex_);
4552
- var blankLine2 = lineBreak2 && two.match(blanklineStartRegex_);
4553
- if (blankLine1 || blankLine2) {
4554
- return 5;
4555
- } else if (lineBreak1 || lineBreak2) {
4556
- return 4;
4557
- } else if (nonAlphaNumeric1 && !whitespace1 && whitespace2) {
4558
- return 3;
4559
- } else if (whitespace1 || whitespace2) {
4560
- return 2;
4561
- } else if (nonAlphaNumeric1 || nonAlphaNumeric2) {
4562
- return 1;
4563
- }
4564
- return 0;
4565
- }
4566
- var pointer = 1;
4567
- while (pointer < diffs.length - 1) {
4568
- if (diffs[pointer - 1][0] == DIFF_EQUAL && diffs[pointer + 1][0] == DIFF_EQUAL) {
4569
- var equality1 = diffs[pointer - 1][1];
4570
- var edit = diffs[pointer][1];
4571
- var equality2 = diffs[pointer + 1][1];
4572
- var commonOffset = diff_commonSuffix(equality1, edit);
4573
- if (commonOffset) {
4574
- var commonString = edit.substring(edit.length - commonOffset);
4575
- equality1 = equality1.substring(0, equality1.length - commonOffset);
4576
- edit = commonString + edit.substring(0, edit.length - commonOffset);
4577
- equality2 = commonString + equality2;
4578
- }
4579
- var bestEquality1 = equality1;
4580
- var bestEdit = edit;
4581
- var bestEquality2 = equality2;
4582
- var bestScore = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2);
4583
- while (edit.charAt(0) === equality2.charAt(0)) {
4584
- equality1 += edit.charAt(0);
4585
- edit = edit.substring(1) + equality2.charAt(0);
4586
- equality2 = equality2.substring(1);
4587
- var score = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2);
4588
- if (score >= bestScore) {
4589
- bestScore = score;
4590
- bestEquality1 = equality1;
4591
- bestEdit = edit;
4592
- bestEquality2 = equality2;
4593
- }
4594
- }
4595
- if (diffs[pointer - 1][1] != bestEquality1) {
4596
- if (bestEquality1) {
4597
- diffs[pointer - 1][1] = bestEquality1;
4598
- } else {
4599
- diffs.splice(pointer - 1, 1);
4600
- pointer--;
4601
- }
4602
- diffs[pointer][1] = bestEdit;
4603
- if (bestEquality2) {
4604
- diffs[pointer + 1][1] = bestEquality2;
4605
- } else {
4606
- diffs.splice(pointer + 1, 1);
4607
- pointer--;
4608
- }
4609
- }
4610
- }
4611
- pointer++;
4612
- }
4613
- }
4614
- function diff_cleanupMerge(diffs, fix_unicode) {
4615
- diffs.push([DIFF_EQUAL, ""]);
4616
- var pointer = 0;
4617
- var count_delete = 0;
4618
- var count_insert = 0;
4619
- var text_delete = "";
4620
- var text_insert = "";
4621
- var commonlength;
4622
- while (pointer < diffs.length) {
4623
- if (pointer < diffs.length - 1 && !diffs[pointer][1]) {
4624
- diffs.splice(pointer, 1);
4625
- continue;
4626
- }
4627
- switch (diffs[pointer][0]) {
4628
- case DIFF_INSERT:
4629
- count_insert++;
4630
- text_insert += diffs[pointer][1];
4631
- pointer++;
4632
- break;
4633
- case DIFF_DELETE:
4634
- count_delete++;
4635
- text_delete += diffs[pointer][1];
4636
- pointer++;
4637
- break;
4638
- case DIFF_EQUAL:
4639
- var previous_equality = pointer - count_insert - count_delete - 1;
4640
- if (fix_unicode) {
4641
- if (previous_equality >= 0 && ends_with_pair_start(diffs[previous_equality][1])) {
4642
- var stray = diffs[previous_equality][1].slice(-1);
4643
- diffs[previous_equality][1] = diffs[previous_equality][1].slice(
4644
- 0,
4645
- -1
4646
- );
4647
- text_delete = stray + text_delete;
4648
- text_insert = stray + text_insert;
4649
- if (!diffs[previous_equality][1]) {
4650
- diffs.splice(previous_equality, 1);
4651
- pointer--;
4652
- var k = previous_equality - 1;
4653
- if (diffs[k] && diffs[k][0] === DIFF_INSERT) {
4654
- count_insert++;
4655
- text_insert = diffs[k][1] + text_insert;
4656
- k--;
4657
- }
4658
- if (diffs[k] && diffs[k][0] === DIFF_DELETE) {
4659
- count_delete++;
4660
- text_delete = diffs[k][1] + text_delete;
4661
- k--;
4662
- }
4663
- previous_equality = k;
4664
- }
4665
- }
4666
- if (starts_with_pair_end(diffs[pointer][1])) {
4667
- var stray = diffs[pointer][1].charAt(0);
4668
- diffs[pointer][1] = diffs[pointer][1].slice(1);
4669
- text_delete += stray;
4670
- text_insert += stray;
4671
- }
4672
- }
4673
- if (pointer < diffs.length - 1 && !diffs[pointer][1]) {
4674
- diffs.splice(pointer, 1);
4675
- break;
4676
- }
4677
- if (text_delete.length > 0 || text_insert.length > 0) {
4678
- if (text_delete.length > 0 && text_insert.length > 0) {
4679
- commonlength = diff_commonPrefix(text_insert, text_delete);
4680
- if (commonlength !== 0) {
4681
- if (previous_equality >= 0) {
4682
- diffs[previous_equality][1] += text_insert.substring(
4683
- 0,
4684
- commonlength
4685
- );
4686
- } else {
4687
- diffs.splice(0, 0, [
4688
- DIFF_EQUAL,
4689
- text_insert.substring(0, commonlength)
4690
- ]);
4691
- pointer++;
4692
- }
4693
- text_insert = text_insert.substring(commonlength);
4694
- text_delete = text_delete.substring(commonlength);
4695
- }
4696
- commonlength = diff_commonSuffix(text_insert, text_delete);
4697
- if (commonlength !== 0) {
4698
- diffs[pointer][1] = text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1];
4699
- text_insert = text_insert.substring(
4700
- 0,
4701
- text_insert.length - commonlength
4702
- );
4703
- text_delete = text_delete.substring(
4704
- 0,
4705
- text_delete.length - commonlength
4706
- );
4707
- }
4708
- }
4709
- var n = count_insert + count_delete;
4710
- if (text_delete.length === 0 && text_insert.length === 0) {
4711
- diffs.splice(pointer - n, n);
4712
- pointer = pointer - n;
4713
- } else if (text_delete.length === 0) {
4714
- diffs.splice(pointer - n, n, [DIFF_INSERT, text_insert]);
4715
- pointer = pointer - n + 1;
4716
- } else if (text_insert.length === 0) {
4717
- diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete]);
4718
- pointer = pointer - n + 1;
4719
- } else {
4720
- diffs.splice(
4721
- pointer - n,
4722
- n,
4723
- [DIFF_DELETE, text_delete],
4724
- [DIFF_INSERT, text_insert]
4725
- );
4726
- pointer = pointer - n + 2;
4727
- }
4728
- }
4729
- if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) {
4730
- diffs[pointer - 1][1] += diffs[pointer][1];
4731
- diffs.splice(pointer, 1);
4732
- } else {
4733
- pointer++;
4734
- }
4735
- count_insert = 0;
4736
- count_delete = 0;
4737
- text_delete = "";
4738
- text_insert = "";
4739
- break;
4740
- }
4741
- }
4742
- if (diffs[diffs.length - 1][1] === "") {
4743
- diffs.pop();
4744
- }
4745
- var changes = false;
4746
- pointer = 1;
4747
- while (pointer < diffs.length - 1) {
4748
- if (diffs[pointer - 1][0] === DIFF_EQUAL && diffs[pointer + 1][0] === DIFF_EQUAL) {
4749
- if (diffs[pointer][1].substring(
4750
- diffs[pointer][1].length - diffs[pointer - 1][1].length
4751
- ) === diffs[pointer - 1][1]) {
4752
- diffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(
4753
- 0,
4754
- diffs[pointer][1].length - diffs[pointer - 1][1].length
4755
- );
4756
- diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
4757
- diffs.splice(pointer - 1, 1);
4758
- changes = true;
4759
- } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == diffs[pointer + 1][1]) {
4760
- diffs[pointer - 1][1] += diffs[pointer + 1][1];
4761
- diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1];
4762
- diffs.splice(pointer + 1, 1);
4763
- changes = true;
4764
- }
4765
- }
4766
- pointer++;
4767
- }
4768
- if (changes) {
4769
- diff_cleanupMerge(diffs, fix_unicode);
4770
- }
4771
- }
4772
- function is_surrogate_pair_start(charCode) {
4773
- return charCode >= 55296 && charCode <= 56319;
4774
- }
4775
- function is_surrogate_pair_end(charCode) {
4776
- return charCode >= 56320 && charCode <= 57343;
4777
- }
4778
- function starts_with_pair_end(str) {
4779
- return is_surrogate_pair_end(str.charCodeAt(0));
4780
- }
4781
- function ends_with_pair_start(str) {
4782
- return is_surrogate_pair_start(str.charCodeAt(str.length - 1));
4783
- }
4784
- function remove_empty_tuples(tuples) {
4785
- var ret = [];
4786
- for (var i = 0; i < tuples.length; i++) {
4787
- if (tuples[i][1].length > 0) {
4788
- ret.push(tuples[i]);
4789
- }
4790
- }
4791
- return ret;
4792
- }
4793
- function make_edit_splice(before, oldMiddle, newMiddle, after) {
4794
- if (ends_with_pair_start(before) || starts_with_pair_end(after)) {
4795
- return null;
4796
- }
4797
- return remove_empty_tuples([
4798
- [DIFF_EQUAL, before],
4799
- [DIFF_DELETE, oldMiddle],
4800
- [DIFF_INSERT, newMiddle],
4801
- [DIFF_EQUAL, after]
4802
- ]);
4803
- }
4804
- function find_cursor_edit_diff(oldText, newText, cursor_pos) {
4805
- var oldRange = typeof cursor_pos === "number" ? { index: cursor_pos, length: 0 } : cursor_pos.oldRange;
4806
- var newRange = typeof cursor_pos === "number" ? null : cursor_pos.newRange;
4807
- var oldLength = oldText.length;
4808
- var newLength = newText.length;
4809
- if (oldRange.length === 0 && (newRange === null || newRange.length === 0)) {
4810
- var oldCursor = oldRange.index;
4811
- var oldBefore = oldText.slice(0, oldCursor);
4812
- var oldAfter = oldText.slice(oldCursor);
4813
- var maybeNewCursor = newRange ? newRange.index : null;
4814
- editBefore: {
4815
- var newCursor = oldCursor + newLength - oldLength;
4816
- if (maybeNewCursor !== null && maybeNewCursor !== newCursor) {
4817
- break editBefore;
4818
- }
4819
- if (newCursor < 0 || newCursor > newLength) {
4820
- break editBefore;
4821
- }
4822
- var newBefore = newText.slice(0, newCursor);
4823
- var newAfter = newText.slice(newCursor);
4824
- if (newAfter !== oldAfter) {
4825
- break editBefore;
4826
- }
4827
- var prefixLength = Math.min(oldCursor, newCursor);
4828
- var oldPrefix = oldBefore.slice(0, prefixLength);
4829
- var newPrefix = newBefore.slice(0, prefixLength);
4830
- if (oldPrefix !== newPrefix) {
4831
- break editBefore;
4832
- }
4833
- var oldMiddle = oldBefore.slice(prefixLength);
4834
- var newMiddle = newBefore.slice(prefixLength);
4835
- return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldAfter);
4836
- }
4837
- editAfter: {
4838
- if (maybeNewCursor !== null && maybeNewCursor !== oldCursor) {
4839
- break editAfter;
4840
- }
4841
- var cursor = oldCursor;
4842
- var newBefore = newText.slice(0, cursor);
4843
- var newAfter = newText.slice(cursor);
4844
- if (newBefore !== oldBefore) {
4845
- break editAfter;
4846
- }
4847
- var suffixLength = Math.min(oldLength - cursor, newLength - cursor);
4848
- var oldSuffix = oldAfter.slice(oldAfter.length - suffixLength);
4849
- var newSuffix = newAfter.slice(newAfter.length - suffixLength);
4850
- if (oldSuffix !== newSuffix) {
4851
- break editAfter;
4852
- }
4853
- var oldMiddle = oldAfter.slice(0, oldAfter.length - suffixLength);
4854
- var newMiddle = newAfter.slice(0, newAfter.length - suffixLength);
4855
- return make_edit_splice(oldBefore, oldMiddle, newMiddle, oldSuffix);
4856
- }
4857
- }
4858
- if (oldRange.length > 0 && newRange && newRange.length === 0) {
4859
- replaceRange: {
4860
- var oldPrefix = oldText.slice(0, oldRange.index);
4861
- var oldSuffix = oldText.slice(oldRange.index + oldRange.length);
4862
- var prefixLength = oldPrefix.length;
4863
- var suffixLength = oldSuffix.length;
4864
- if (newLength < prefixLength + suffixLength) {
4865
- break replaceRange;
4866
- }
4867
- var newPrefix = newText.slice(0, prefixLength);
4868
- var newSuffix = newText.slice(newLength - suffixLength);
4869
- if (oldPrefix !== newPrefix || oldSuffix !== newSuffix) {
4870
- break replaceRange;
4871
- }
4872
- var oldMiddle = oldText.slice(prefixLength, oldLength - suffixLength);
4873
- var newMiddle = newText.slice(prefixLength, newLength - suffixLength);
4874
- return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldSuffix);
4875
- }
4876
- }
4877
- return null;
4878
- }
4879
- function diff(text1, text2, cursor_pos, cleanup) {
4880
- return diff_main(text1, text2, cursor_pos, cleanup, true);
4881
- }
4882
- diff.INSERT = DIFF_INSERT;
4883
- diff.DELETE = DIFF_DELETE;
4884
- diff.EQUAL = DIFF_EQUAL;
4885
- module.exports = diff;
4886
- }
4887
- });
4888
-
4889
- // node_modules/prettier-linter-helpers/index.js
4890
- var require_prettier_linter_helpers = __commonJS({
4891
- "node_modules/prettier-linter-helpers/index.js"(exports, module) {
4892
- "use strict";
4893
- var diff = require_diff();
4894
- var LINE_ENDING_RE = /\r\n|[\r\n\u2028\u2029]/;
4895
- function showInvisibles(str) {
4896
- let ret = "";
4897
- for (let i = 0; i < str.length; i++) {
4898
- switch (str[i]) {
4899
- case " ":
4900
- ret += "\xB7";
4901
- break;
4902
- case "\n":
4903
- ret += "\u23CE";
4904
- break;
4905
- case " ":
4906
- ret += "\u21B9";
4907
- break;
4908
- case "\r":
4909
- ret += "\u240D";
4910
- break;
4911
- default:
4912
- ret += str[i];
4913
- break;
4914
- }
4915
- }
4916
- return ret;
4917
- }
4918
- function generateDifferences(source, prettierSource) {
4919
- const results = diff(source, prettierSource);
4920
- const differences = [];
4921
- const batch = [];
4922
- let offset = 0;
4923
- while (results.length) {
4924
- const result = results.shift();
4925
- const op = result[0];
4926
- const text = result[1];
4927
- switch (op) {
4928
- case diff.INSERT:
4929
- case diff.DELETE:
4930
- batch.push(result);
4931
- break;
4932
- case diff.EQUAL:
4933
- if (results.length) {
4934
- if (batch.length) {
4935
- if (LINE_ENDING_RE.test(text)) {
4936
- flush();
4937
- offset += text.length;
4938
- } else {
4939
- batch.push(result);
4940
- }
4941
- } else {
4942
- offset += text.length;
4943
- }
4944
- }
4945
- break;
4946
- default:
4947
- throw new Error(`Unexpected fast-diff operation "${op}"`);
4948
- }
4949
- if (batch.length && !results.length) {
4950
- flush();
4951
- }
4952
- }
4953
- return differences;
4954
- function flush() {
4955
- let aheadDeleteText = "";
4956
- let aheadInsertText = "";
4957
- while (batch.length) {
4958
- const next = batch.shift();
4959
- const op = next[0];
4960
- const text = next[1];
4961
- switch (op) {
4962
- case diff.INSERT:
4963
- aheadInsertText += text;
4964
- break;
4965
- case diff.DELETE:
4966
- aheadDeleteText += text;
4967
- break;
4968
- case diff.EQUAL:
4969
- aheadDeleteText += text;
4970
- aheadInsertText += text;
4971
- break;
4972
- }
4973
- }
4974
- if (aheadDeleteText && aheadInsertText) {
4975
- differences.push({
4976
- offset,
4977
- operation: generateDifferences.REPLACE,
4978
- insertText: aheadInsertText,
4979
- deleteText: aheadDeleteText
4980
- });
4981
- } else if (!aheadDeleteText && aheadInsertText) {
4982
- differences.push({
4983
- offset,
4984
- operation: generateDifferences.INSERT,
4985
- insertText: aheadInsertText
4986
- });
4987
- } else if (aheadDeleteText && !aheadInsertText) {
4988
- differences.push({
4989
- offset,
4990
- operation: generateDifferences.DELETE,
4991
- deleteText: aheadDeleteText
4992
- });
4993
- }
4994
- offset += aheadDeleteText.length;
4995
- }
4996
- }
4997
- generateDifferences.INSERT = "insert";
4998
- generateDifferences.DELETE = "delete";
4999
- generateDifferences.REPLACE = "replace";
5000
- module.exports = {
5001
- showInvisibles,
5002
- generateDifferences
5003
- };
5004
- }
5005
- });
5006
-
5007
- // node_modules/eslint-plugin-prettier/package.json
5008
- var require_package2 = __commonJS({
5009
- "node_modules/eslint-plugin-prettier/package.json"(exports, module) {
5010
- module.exports = {
5011
- name: "eslint-plugin-prettier",
5012
- version: "5.5.3",
5013
- description: "Runs prettier as an eslint rule",
5014
- repository: "https://github.com/prettier/eslint-plugin-prettier.git",
5015
- homepage: "https://github.com/prettier/eslint-plugin-prettier#readme",
5016
- author: "Teddy Katz",
5017
- maintainers: [
5018
- "JounQin <admin@1stg.me> (https://github.com/JounQin)"
5019
- ],
5020
- funding: "https://opencollective.com/eslint-plugin-prettier",
5021
- license: "MIT",
5022
- engines: {
5023
- node: "^14.18.0 || >=16.0.0"
5024
- },
5025
- main: "eslint-plugin-prettier.js",
5026
- types: "eslint-plugin-prettier.d.ts",
5027
- exports: {
5028
- ".": {
5029
- types: "./eslint-plugin-prettier.d.ts",
5030
- default: "./eslint-plugin-prettier.js"
5031
- },
5032
- "./recommended": {
5033
- types: "./recommended.d.ts",
5034
- default: "./recommended.js"
5035
- },
5036
- "./package.json": "./package.json"
5037
- },
5038
- files: [
5039
- "eslint-plugin-prettier.d.ts",
5040
- "eslint-plugin-prettier.js",
5041
- "recommended.d.ts",
5042
- "recommended.js",
5043
- "worker.mjs"
5044
- ],
5045
- keywords: [
5046
- "eslint",
5047
- "eslintplugin",
5048
- "eslint-plugin",
5049
- "prettier"
5050
- ],
5051
- peerDependencies: {
5052
- "@types/eslint": ">=8.0.0",
5053
- eslint: ">=8.0.0",
5054
- "eslint-config-prettier": ">= 7.0.0 <10.0.0 || >=10.1.0",
5055
- prettier: ">=3.0.0"
5056
- },
5057
- peerDependenciesMeta: {
5058
- "@types/eslint": {
5059
- optional: true
5060
- },
5061
- "eslint-config-prettier": {
5062
- optional: true
5063
- }
5064
- },
5065
- dependencies: {
5066
- "prettier-linter-helpers": "^1.0.0",
5067
- synckit: "^0.11.7"
5068
- }
5069
- };
5070
- }
5071
- });
5072
-
5073
- // node_modules/@pkgr/core/lib/index.cjs
5074
- var require_lib = __commonJS({
5075
- "node_modules/@pkgr/core/lib/index.cjs"(exports) {
5076
- "use strict";
5077
- var node_module = __require("module");
5078
- var fs = __require("fs");
5079
- var path2 = __require("path");
5080
- var import_meta = {};
5081
- var CWD = process.cwd();
5082
- var importMetaUrl = import_meta.url;
5083
- var cjsRequire = importMetaUrl ? node_module.createRequire(importMetaUrl) : __require;
5084
- var EVAL_FILENAMES = /* @__PURE__ */ new Set(["[eval]", "[worker eval]"]);
5085
- var EXTENSIONS = [".ts", ".tsx", ...Object.keys(cjsRequire.extensions)];
5086
- var tryPkg = (pkg) => {
5087
- try {
5088
- return cjsRequire.resolve(pkg);
5089
- } catch (e) {
5090
- }
5091
- };
5092
- var isPkgAvailable = (pkg) => !!tryPkg(pkg);
5093
- var tryFile = (filename, includeDir = false, base = CWD) => {
5094
- if (typeof filename === "string") {
5095
- const filepath = path2.resolve(base, filename);
5096
- return fs.existsSync(filepath) && (includeDir || fs.statSync(filepath).isFile()) ? filepath : "";
5097
- }
5098
- for (const file of filename != null ? filename : []) {
5099
- const filepath = tryFile(file, includeDir, base);
5100
- if (filepath) {
5101
- return filepath;
5102
- }
5103
- }
5104
- return "";
5105
- };
5106
- var tryExtensions = (filepath, extensions = EXTENSIONS) => {
5107
- const ext = [...extensions, ""].find((ext2) => tryFile(filepath + ext2));
5108
- return ext == null ? "" : filepath + ext;
5109
- };
5110
- var findUp = (searchEntry, searchFileOrIncludeDir, includeDir) => {
5111
- const isSearchFile = typeof searchFileOrIncludeDir === "string";
5112
- const searchFile = isSearchFile ? searchFileOrIncludeDir : "package.json";
5113
- let lastSearchEntry;
5114
- do {
5115
- const searched = tryFile(
5116
- searchFile,
5117
- isSearchFile && includeDir,
5118
- searchEntry
5119
- );
5120
- if (searched) {
5121
- return searched;
5122
- }
5123
- lastSearchEntry = searchEntry;
5124
- searchEntry = path2.dirname(searchEntry);
5125
- } while (!lastSearchEntry || lastSearchEntry !== searchEntry);
5126
- return "";
5127
- };
5128
- exports.CWD = CWD;
5129
- exports.EVAL_FILENAMES = EVAL_FILENAMES;
5130
- exports.EXTENSIONS = EXTENSIONS;
5131
- exports.cjsRequire = cjsRequire;
5132
- exports.findUp = findUp;
5133
- exports.isPkgAvailable = isPkgAvailable;
5134
- exports.tryExtensions = tryExtensions;
5135
- exports.tryFile = tryFile;
5136
- exports.tryPkg = tryPkg;
5137
- }
5138
- });
5139
-
5140
- // node_modules/synckit/lib/index.cjs
5141
- var require_lib2 = __commonJS({
5142
- "node_modules/synckit/lib/index.cjs"(exports) {
5143
- "use strict";
5144
- var __create2 = Object.create;
5145
- var __defProp2 = Object.defineProperty;
5146
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
5147
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
5148
- var __getProtoOf2 = Object.getPrototypeOf;
5149
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
5150
- var __copyProps2 = (to, from, except, desc) => {
5151
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames2(from), i = 0, n = keys.length, key; i < n; i++) {
5152
- key = keys[i];
5153
- if (!__hasOwnProp2.call(to, key) && key !== except) __defProp2(to, key, {
5154
- get: ((k) => from[k]).bind(null, key),
5155
- enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable
5156
- });
5157
- }
5158
- return to;
5159
- };
5160
- var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", {
5161
- value: mod,
5162
- enumerable: true
5163
- }) : target, mod));
5164
- var node_module = __toESM2(__require("module"));
5165
- var node_path = __toESM2(__require("path"));
5166
- var node_url = __toESM2(__require("url"));
5167
- var node_worker_threads = __toESM2(__require("worker_threads"));
5168
- var node_crypto = __toESM2(__require("crypto"));
5169
- var node_fs = __toESM2(__require("fs"));
5170
- var __pkgr_core = __toESM2(require_lib());
5171
- var _process$env$NODE_OPT;
5172
- var NODE_OPTIONS$1 = (_process$env$NODE_OPT = process.env.NODE_OPTIONS) === null || _process$env$NODE_OPT === void 0 ? void 0 : _process$env$NODE_OPT.split(/\s+/);
5173
- var hasFlag = (flag) => (NODE_OPTIONS$1 === null || NODE_OPTIONS$1 === void 0 ? void 0 : NODE_OPTIONS$1.includes(flag)) || process.argv.includes(flag);
5174
- var parseVersion = (version2) => version2.split(".").map(Number.parseFloat);
5175
- var compareVersion = (version1, version2) => {
5176
- const versions1 = parseVersion(version1);
5177
- const versions2 = parseVersion(version2);
5178
- const length = Math.max(versions1.length, versions2.length);
5179
- for (let i = 0; i < length; i++) {
5180
- const v1 = versions1[i] || 0;
5181
- const v2 = versions2[i] || 0;
5182
- if (v1 > v2) return 1;
5183
- if (v1 < v2) return -1;
5184
- }
5185
- return 0;
5186
- };
5187
- var NODE_VERSION = process.versions.node;
5188
- var compareNodeVersion = (version2) => compareVersion(NODE_VERSION, version2);
5189
- var TsRunner = {
5190
- Node: "node",
5191
- Bun: "bun",
5192
- TsNode: "ts-node",
5193
- EsbuildRegister: "esbuild-register",
5194
- EsbuildRunner: "esbuild-runner",
5195
- OXC: "oxc",
5196
- SWC: "swc",
5197
- TSX: "tsx"
5198
- };
5199
- var { NODE_OPTIONS: NODE_OPTIONS_ = "", SYNCKIT_EXEC_ARGV = "", SYNCKIT_GLOBAL_SHIMS, SYNCKIT_TIMEOUT, SYNCKIT_TS_RUNNER } = process.env;
5200
- var TS_ESM_PARTIAL_SUPPORTED = compareNodeVersion("16") >= 0 && compareNodeVersion("18.19") < 0;
5201
- var MTS_SUPPORTED = compareNodeVersion("20.8") >= 0;
5202
- var MODULE_REGISTER_SUPPORTED = MTS_SUPPORTED || compareNodeVersion("18.19") >= 0;
5203
- var STRIP_TYPES_NODE_VERSION = "22.6";
5204
- var TRANSFORM_TYPES_NODE_VERSION = "22.7";
5205
- var FEATURE_TYPESCRIPT_NODE_VERSION = "22.10";
5206
- var DEFAULT_TYPES_NODE_VERSION = "23.6";
5207
- var STRIP_TYPES_FLAG = "--experimental-strip-types";
5208
- var TRANSFORM_TYPES_FLAG = "--experimental-transform-types";
5209
- var NO_STRIP_TYPES_FLAG = "--no-experimental-strip-types";
5210
- var NODE_OPTIONS = NODE_OPTIONS_.split(/\s+/);
5211
- var NO_STRIP_TYPES = hasFlag(NO_STRIP_TYPES_FLAG) && (compareNodeVersion(FEATURE_TYPESCRIPT_NODE_VERSION) >= 0 ? process.features.typescript === false : !hasFlag(STRIP_TYPES_FLAG) && !hasFlag(TRANSFORM_TYPES_FLAG));
5212
- var DEFAULT_TIMEOUT = SYNCKIT_TIMEOUT ? +SYNCKIT_TIMEOUT : void 0;
5213
- var DEFAULT_EXEC_ARGV = SYNCKIT_EXEC_ARGV.split(",");
5214
- var DEFAULT_TS_RUNNER = SYNCKIT_TS_RUNNER;
5215
- var DEFAULT_GLOBAL_SHIMS = ["1", "true"].includes(SYNCKIT_GLOBAL_SHIMS);
5216
- var DEFAULT_GLOBAL_SHIMS_PRESET = [{
5217
- moduleName: "node-fetch",
5218
- globalName: "fetch"
5219
- }, {
5220
- moduleName: "node:perf_hooks",
5221
- globalName: "performance",
5222
- named: "performance"
5223
- }];
5224
- var IMPORT_FLAG = "--import";
5225
- var REQUIRE_FLAG = "--require";
5226
- var REQUIRE_ABBR_FLAG = "-r";
5227
- var REQUIRE_FLAGS = /* @__PURE__ */ new Set([REQUIRE_FLAG, REQUIRE_ABBR_FLAG]);
5228
- var LOADER_FLAG = "--loader";
5229
- var EXPERIMENTAL_LOADER_FLAG = "--experimental-loader";
5230
- var LOADER_FLAGS = /* @__PURE__ */ new Set([LOADER_FLAG, EXPERIMENTAL_LOADER_FLAG]);
5231
- var IMPORT_FLAG_SUPPORTED = compareNodeVersion("20.6") >= 0;
5232
- var INT32_BYTES = 4;
5233
- var isFile = (path$2) => {
5234
- try {
5235
- var _fs$statSync;
5236
- return !!((_fs$statSync = node_fs.default.statSync(path$2, { throwIfNoEntry: false })) === null || _fs$statSync === void 0 ? void 0 : _fs$statSync.isFile());
5237
- } catch (e) {
5238
- return false;
5239
- }
5240
- };
5241
- var dataUrl = (code) => new URL(`data:text/javascript,${encodeURIComponent(code)}`);
5242
- var hasRequireFlag = (execArgv) => execArgv.some((execArg) => REQUIRE_FLAGS.has(execArg));
5243
- var hasImportFlag = (execArgv) => execArgv.includes(IMPORT_FLAG);
5244
- var hasLoaderFlag = (execArgv) => execArgv.some((execArg) => LOADER_FLAGS.has(execArg));
5245
- var setupTsRunner = (workerPath, { execArgv = DEFAULT_EXEC_ARGV, tsRunner } = {}) => {
5246
- let ext = node_path.default.extname(workerPath);
5247
- if (!/([/\\])node_modules\1/.test(workerPath) && (!ext || /^\.[cm]?js$/.test(ext))) {
5248
- const workPathWithoutExt = ext ? workerPath.slice(0, -ext.length) : workerPath;
5249
- let extensions;
5250
- switch (ext) {
5251
- case ".cjs": {
5252
- extensions = [".cts", ".cjs"];
5253
- break;
5254
- }
5255
- case ".mjs": {
5256
- extensions = [".mts", ".mjs"];
5257
- break;
5258
- }
5259
- default: {
5260
- extensions = [".ts", ".js"];
5261
- break;
5262
- }
5263
- }
5264
- const found = (0, __pkgr_core.tryExtensions)(workPathWithoutExt, extensions);
5265
- let differentExt;
5266
- if (found && (!ext || (differentExt = found !== workPathWithoutExt))) {
5267
- workerPath = found;
5268
- if (differentExt) ext = node_path.default.extname(workerPath);
5269
- }
5270
- }
5271
- const isTs = /\.[cm]?ts$/.test(workerPath);
5272
- let jsUseEsm = ext === ".mjs";
5273
- let tsUseEsm = ext === ".mts";
5274
- if (isTs) {
5275
- if (!tsUseEsm && ext !== ".cts") {
5276
- const pkg = (0, __pkgr_core.findUp)(workerPath);
5277
- if (pkg) tsUseEsm = (0, __pkgr_core.cjsRequire)(pkg).type === "module";
5278
- }
5279
- const stripTypesIndex = execArgv.indexOf(STRIP_TYPES_FLAG);
5280
- const transformTypesIndex = execArgv.indexOf(TRANSFORM_TYPES_FLAG);
5281
- const noStripTypesIndex = execArgv.indexOf(NO_STRIP_TYPES_FLAG);
5282
- const execArgvNoStripTypes = noStripTypesIndex > stripTypesIndex || noStripTypesIndex > transformTypesIndex;
5283
- const noStripTypes = execArgvNoStripTypes || stripTypesIndex === -1 && transformTypesIndex === -1 && NO_STRIP_TYPES;
5284
- if (tsRunner == null) {
5285
- if (process.versions.bun) tsRunner = TsRunner.Bun;
5286
- else if (!noStripTypes && compareNodeVersion(STRIP_TYPES_NODE_VERSION) >= 0) tsRunner = TsRunner.Node;
5287
- else if ((0, __pkgr_core.isPkgAvailable)(TsRunner.TsNode)) tsRunner = TsRunner.TsNode;
5288
- }
5289
- switch (tsRunner) {
5290
- case TsRunner.Bun:
5291
- break;
5292
- case TsRunner.Node: {
5293
- if (compareNodeVersion(STRIP_TYPES_NODE_VERSION) < 0) throw new Error("type stripping is not supported in this node version");
5294
- if (noStripTypes) throw new Error("type stripping is disabled explicitly");
5295
- if (compareNodeVersion(DEFAULT_TYPES_NODE_VERSION) >= 0) break;
5296
- if (compareNodeVersion(TRANSFORM_TYPES_NODE_VERSION) >= 0 && !execArgv.includes(TRANSFORM_TYPES_FLAG)) execArgv = [TRANSFORM_TYPES_FLAG, ...execArgv];
5297
- else if (compareNodeVersion(STRIP_TYPES_NODE_VERSION) >= 0 && !execArgv.includes(STRIP_TYPES_FLAG)) execArgv = [STRIP_TYPES_FLAG, ...execArgv];
5298
- break;
5299
- }
5300
- case TsRunner.TsNode: {
5301
- if (tsUseEsm) {
5302
- if (!execArgv.includes(LOADER_FLAG)) execArgv = [
5303
- LOADER_FLAG,
5304
- `${TsRunner.TsNode}/esm`,
5305
- ...execArgv
5306
- ];
5307
- } else if (!hasRequireFlag(execArgv)) execArgv = [
5308
- REQUIRE_ABBR_FLAG,
5309
- `${TsRunner.TsNode}/register`,
5310
- ...execArgv
5311
- ];
5312
- break;
5313
- }
5314
- case TsRunner.EsbuildRegister: {
5315
- if (tsUseEsm) {
5316
- if (!hasLoaderFlag(execArgv)) execArgv = [
5317
- LOADER_FLAG,
5318
- `${TsRunner.EsbuildRegister}/loader`,
5319
- ...execArgv
5320
- ];
5321
- } else if (!hasRequireFlag(execArgv)) execArgv = [
5322
- REQUIRE_ABBR_FLAG,
5323
- TsRunner.EsbuildRegister,
5324
- ...execArgv
5325
- ];
5326
- break;
5327
- }
5328
- case TsRunner.EsbuildRunner: {
5329
- if (!hasRequireFlag(execArgv)) execArgv = [
5330
- REQUIRE_ABBR_FLAG,
5331
- `${TsRunner.EsbuildRunner}/register`,
5332
- ...execArgv
5333
- ];
5334
- break;
5335
- }
5336
- case TsRunner.OXC: {
5337
- if (!execArgv.includes(IMPORT_FLAG)) execArgv = [
5338
- IMPORT_FLAG,
5339
- `@${TsRunner.OXC}-node/core/register`,
5340
- ...execArgv
5341
- ];
5342
- break;
5343
- }
5344
- case TsRunner.SWC: {
5345
- if (tsUseEsm) {
5346
- if (IMPORT_FLAG_SUPPORTED) {
5347
- if (!hasImportFlag(execArgv)) execArgv = [
5348
- IMPORT_FLAG,
5349
- `@${TsRunner.SWC}-node/register/esm-register`,
5350
- ...execArgv
5351
- ];
5352
- } else if (!hasLoaderFlag(execArgv)) execArgv = [
5353
- LOADER_FLAG,
5354
- `@${TsRunner.SWC}-node/register/esm`,
5355
- ...execArgv
5356
- ];
5357
- } else if (!hasRequireFlag(execArgv)) execArgv = [
5358
- REQUIRE_ABBR_FLAG,
5359
- `@${TsRunner.SWC}-node/register`,
5360
- ...execArgv
5361
- ];
5362
- break;
5363
- }
5364
- case TsRunner.TSX: {
5365
- if (IMPORT_FLAG_SUPPORTED) {
5366
- if (!execArgv.includes(IMPORT_FLAG)) execArgv = [
5367
- IMPORT_FLAG,
5368
- TsRunner.TSX,
5369
- ...execArgv
5370
- ];
5371
- } else if (!execArgv.includes(LOADER_FLAG)) execArgv = [
5372
- LOADER_FLAG,
5373
- TsRunner.TSX,
5374
- ...execArgv
5375
- ];
5376
- break;
5377
- }
5378
- default:
5379
- throw new Error(`Unknown ts runner: ${String(tsRunner)}`);
5380
- }
5381
- } else if (!jsUseEsm && ext !== ".cjs") {
5382
- const pkg = (0, __pkgr_core.findUp)(workerPath);
5383
- if (pkg) jsUseEsm = (0, __pkgr_core.cjsRequire)(pkg).type === "module";
5384
- }
5385
- let resolvedPnpLoaderPath;
5386
- if (process.versions.pnp) {
5387
- let pnpApiPath;
5388
- try {
5389
- pnpApiPath = __pkgr_core.cjsRequire.resolve("pnpapi");
5390
- } catch (e) {
5391
- }
5392
- if (pnpApiPath && !NODE_OPTIONS.some((option, index) => REQUIRE_FLAGS.has(option) && pnpApiPath === __pkgr_core.cjsRequire.resolve(NODE_OPTIONS[index + 1])) && !execArgv.includes(pnpApiPath)) {
5393
- execArgv = [
5394
- REQUIRE_ABBR_FLAG,
5395
- pnpApiPath,
5396
- ...execArgv
5397
- ];
5398
- const pnpLoaderPath = node_path.default.resolve(pnpApiPath, "../.pnp.loader.mjs");
5399
- if (isFile(pnpLoaderPath)) {
5400
- resolvedPnpLoaderPath = (0, node_url.pathToFileURL)(pnpLoaderPath).href;
5401
- if (!MODULE_REGISTER_SUPPORTED) execArgv = [
5402
- LOADER_FLAG,
5403
- resolvedPnpLoaderPath,
5404
- ...execArgv
5405
- ];
5406
- }
5407
- }
5408
- }
5409
- return {
5410
- ext,
5411
- isTs,
5412
- jsUseEsm,
5413
- tsRunner,
5414
- tsUseEsm,
5415
- workerPath,
5416
- pnpLoaderPath: resolvedPnpLoaderPath,
5417
- execArgv
5418
- };
5419
- };
5420
- var md5Hash = (text) => (0, node_crypto.createHash)("md5").update(text).digest("hex");
5421
- var encodeImportModule = (moduleNameOrGlobalShim, type = "import") => {
5422
- const { moduleName, globalName, named, conditional } = typeof moduleNameOrGlobalShim === "string" ? { moduleName: moduleNameOrGlobalShim } : moduleNameOrGlobalShim;
5423
- const importStatement = type === "import" ? `import${globalName ? " " + (named === null ? "* as " + globalName : (named === null || named === void 0 ? void 0 : named.trim()) ? `{${named}}` : globalName) + " from" : ""} '${node_path.default.isAbsolute(moduleName) ? String((0, node_url.pathToFileURL)(moduleName)) : moduleName}'` : `${globalName ? "const " + ((named === null || named === void 0 ? void 0 : named.trim()) ? `{${named}}` : globalName) + "=" : ""}require('${moduleName.replace(/\\/g, "\\\\")}')`;
5424
- if (!globalName) return importStatement;
5425
- const overrideStatement = `globalThis.${globalName}=${(named === null || named === void 0 ? void 0 : named.trim()) ? named : globalName}`;
5426
- return importStatement + (conditional === false ? `;${overrideStatement}` : `;if(!globalThis.${globalName})${overrideStatement}`);
5427
- };
5428
- var _generateGlobals = (globalShims, type) => globalShims.reduce((acc, shim) => `${acc}${acc ? ";" : ""}${encodeImportModule(shim, type)}`, "");
5429
- var globalsCache;
5430
- var tmpdir;
5431
- var _dirname = typeof __dirname === "undefined" ? node_path.default.dirname((0, node_url.fileURLToPath)(__require("url").pathToFileURL(__filename).href)) : __dirname;
5432
- var generateGlobals = (workerPath, globalShims, type = "import") => {
5433
- if (globalShims.length === 0) return "";
5434
- globalsCache != null ? globalsCache : globalsCache = /* @__PURE__ */ new Map();
5435
- const cached = globalsCache.get(workerPath);
5436
- if (cached) {
5437
- const [content$1, filepath$1] = cached;
5438
- if (type === "require" && !filepath$1 || type === "import" && filepath$1 && isFile(filepath$1)) return content$1;
5439
- }
5440
- const globals3 = _generateGlobals(globalShims, type);
5441
- let content = globals3;
5442
- let filepath;
5443
- if (type === "import") {
5444
- if (!tmpdir) tmpdir = node_path.default.resolve((0, __pkgr_core.findUp)(_dirname), "../node_modules/.synckit");
5445
- node_fs.default.mkdirSync(tmpdir, { recursive: true });
5446
- filepath = node_path.default.resolve(tmpdir, md5Hash(workerPath) + ".mjs");
5447
- content = encodeImportModule(filepath);
5448
- node_fs.default.writeFileSync(filepath, globals3);
5449
- }
5450
- globalsCache.set(workerPath, [content, filepath]);
5451
- return content;
5452
- };
5453
- function extractProperties(object) {
5454
- if (object && typeof object === "object") {
5455
- const properties = {};
5456
- for (const key in object) properties[key] = object[key];
5457
- return properties;
5458
- }
5459
- }
5460
- var sharedBuffer;
5461
- var sharedBufferView;
5462
- function startWorkerThread(workerPath, { timeout = DEFAULT_TIMEOUT, execArgv = DEFAULT_EXEC_ARGV, tsRunner = DEFAULT_TS_RUNNER, transferList = [], globalShims = DEFAULT_GLOBAL_SHIMS } = {}) {
5463
- const { port1: mainPort, port2: workerPort } = new node_worker_threads.MessageChannel();
5464
- const { isTs, ext, jsUseEsm, tsUseEsm, tsRunner: finalTsRunner, workerPath: finalWorkerPath, pnpLoaderPath, execArgv: finalExecArgv } = setupTsRunner(workerPath, {
5465
- execArgv,
5466
- tsRunner
5467
- });
5468
- const workerPathUrl = (0, node_url.pathToFileURL)(finalWorkerPath);
5469
- if (/\.[cm]ts$/.test(finalWorkerPath)) {
5470
- const isTsxSupported = !tsUseEsm || TS_ESM_PARTIAL_SUPPORTED;
5471
- if (!finalTsRunner) throw new Error("No ts runner specified, ts worker path is not supported");
5472
- else if ([
5473
- TsRunner.EsbuildRegister,
5474
- TsRunner.EsbuildRunner,
5475
- ...TS_ESM_PARTIAL_SUPPORTED ? [TsRunner.OXC, TsRunner.SWC] : [],
5476
- ...isTsxSupported ? [] : [TsRunner.TSX]
5477
- ].includes(finalTsRunner)) throw new Error(`${finalTsRunner} is not supported for ${ext} files yet` + (isTsxSupported ? ", you can try [tsx](https://github.com/esbuild-kit/tsx) instead" : MTS_SUPPORTED ? ", you can try [oxc](https://github.com/oxc-project/oxc-node) or [swc](https://github.com/swc-project/swc-node/tree/master/packages/register) instead" : ""));
5478
- }
5479
- const finalGlobalShims = (globalShims === true ? DEFAULT_GLOBAL_SHIMS_PRESET : Array.isArray(globalShims) ? globalShims : []).filter(({ moduleName }) => (0, __pkgr_core.isPkgAvailable)(moduleName));
5480
- sharedBufferView != null ? sharedBufferView : sharedBufferView = new Int32Array(sharedBuffer != null ? sharedBuffer : sharedBuffer = new SharedArrayBuffer(INT32_BYTES), 0, 1);
5481
- const useGlobals = finalGlobalShims.length > 0;
5482
- const useEval = isTs ? !tsUseEsm : !jsUseEsm && useGlobals;
5483
- const worker = new node_worker_threads.Worker(jsUseEsm && useGlobals || tsUseEsm && finalTsRunner === TsRunner.TsNode ? dataUrl(`${generateGlobals(finalWorkerPath, finalGlobalShims)};import '${String(workerPathUrl)}'`) : useEval ? `${generateGlobals(finalWorkerPath, finalGlobalShims, "require")};${encodeImportModule(finalWorkerPath, "require")}` : workerPathUrl, {
5484
- eval: useEval,
5485
- workerData: {
5486
- sharedBufferView,
5487
- workerPort,
5488
- pnpLoaderPath
5489
- },
5490
- transferList: [workerPort, ...transferList],
5491
- execArgv: finalExecArgv
5492
- });
5493
- let nextID = 0;
5494
- const receiveMessageWithId = (port, expectedId, waitingTimeout) => {
5495
- const start = Date.now();
5496
- const status = Atomics.wait(sharedBufferView, 0, 0, waitingTimeout);
5497
- Atomics.store(sharedBufferView, 0, 0);
5498
- if (!["ok", "not-equal"].includes(status)) {
5499
- const abortMsg = {
5500
- id: expectedId,
5501
- cmd: "abort"
5502
- };
5503
- port.postMessage(abortMsg);
5504
- throw new Error("Internal error: Atomics.wait() failed: " + status);
5505
- }
5506
- const result = (0, node_worker_threads.receiveMessageOnPort)(mainPort);
5507
- const msg = result === null || result === void 0 ? void 0 : result.message;
5508
- if ((msg === null || msg === void 0 ? void 0 : msg.id) == null || msg.id < expectedId) {
5509
- const waitingTime = Date.now() - start;
5510
- return receiveMessageWithId(port, expectedId, waitingTimeout ? waitingTimeout - waitingTime : void 0);
5511
- }
5512
- const _a = msg, { id } = _a, message = __objRest(_a, ["id"]);
5513
- if (expectedId !== id) throw new Error(`Internal error: Expected id ${expectedId} but got id ${id}`);
5514
- return __spreadValues({
5515
- id
5516
- }, message);
5517
- };
5518
- const syncFn = (...args) => {
5519
- const id = nextID++;
5520
- const msg = {
5521
- id,
5522
- args
5523
- };
5524
- worker.postMessage(msg);
5525
- const { result, error, properties, stdio } = receiveMessageWithId(mainPort, id, timeout);
5526
- for (const { type, chunk, encoding } of stdio) process[type].write(chunk, encoding);
5527
- if (error) throw Object.assign(error, properties);
5528
- return result;
5529
- };
5530
- worker.unref();
5531
- return syncFn;
5532
- }
5533
- var overrideStdio = (stdio) => {
5534
- for (const type of ["stdout", "stderr"]) process[type]._writev = (chunks, callback) => {
5535
- for (const { chunk, encoding } of chunks) stdio.push({
5536
- type,
5537
- chunk,
5538
- encoding
5539
- });
5540
- callback();
5541
- };
5542
- };
5543
- var syncFnCache;
5544
- function createSyncFn(workerPath, timeoutOrOptions) {
5545
- syncFnCache != null ? syncFnCache : syncFnCache = /* @__PURE__ */ new Map();
5546
- if (typeof workerPath !== "string" || workerPath.startsWith("file://")) workerPath = (0, node_url.fileURLToPath)(workerPath);
5547
- const cachedSyncFn = syncFnCache.get(workerPath);
5548
- if (cachedSyncFn) return cachedSyncFn;
5549
- if (!node_path.default.isAbsolute(workerPath)) throw new Error("`workerPath` must be absolute");
5550
- const syncFn = startWorkerThread(
5551
- workerPath,
5552
- /* istanbul ignore next */
5553
- typeof timeoutOrOptions === "number" ? { timeout: timeoutOrOptions } : timeoutOrOptions
5554
- );
5555
- syncFnCache.set(workerPath, syncFn);
5556
- return syncFn;
5557
- }
5558
- function runAsWorker(fn) {
5559
- if (!node_worker_threads.workerData) return;
5560
- const stdio = [];
5561
- overrideStdio(stdio);
5562
- const { workerPort, sharedBufferView: sharedBufferView$1, pnpLoaderPath } = node_worker_threads.workerData;
5563
- if (pnpLoaderPath && MODULE_REGISTER_SUPPORTED) node_module.default.register(pnpLoaderPath);
5564
- node_worker_threads.parentPort.on("message", ({ id, args }) => {
5565
- (() => __async(null, null, function* () {
5566
- let isAborted = false;
5567
- const handleAbortMessage = (msg$1) => {
5568
- if (msg$1.id === id && msg$1.cmd === "abort") isAborted = true;
5569
- };
5570
- workerPort.on("message", handleAbortMessage);
5571
- let msg;
5572
- try {
5573
- msg = {
5574
- id,
5575
- stdio,
5576
- result: yield fn(...args)
5577
- };
5578
- } catch (error) {
5579
- msg = {
5580
- id,
5581
- stdio,
5582
- error,
5583
- properties: extractProperties(error)
5584
- };
5585
- }
5586
- workerPort.off("message", handleAbortMessage);
5587
- if (isAborted) {
5588
- stdio.length = 0;
5589
- return;
5590
- }
5591
- try {
5592
- workerPort.postMessage(msg);
5593
- Atomics.add(sharedBufferView$1, 0, 1);
5594
- Atomics.notify(sharedBufferView$1, 0);
5595
- } finally {
5596
- stdio.length = 0;
5597
- }
5598
- }))();
5599
- });
5600
- }
5601
- exports.DEFAULT_EXEC_ARGV = DEFAULT_EXEC_ARGV;
5602
- exports.DEFAULT_GLOBAL_SHIMS = DEFAULT_GLOBAL_SHIMS;
5603
- exports.DEFAULT_GLOBAL_SHIMS_PRESET = DEFAULT_GLOBAL_SHIMS_PRESET;
5604
- exports.DEFAULT_TIMEOUT = DEFAULT_TIMEOUT;
5605
- exports.DEFAULT_TS_RUNNER = DEFAULT_TS_RUNNER;
5606
- exports.DEFAULT_TYPES_NODE_VERSION = DEFAULT_TYPES_NODE_VERSION;
5607
- exports.EXPERIMENTAL_LOADER_FLAG = EXPERIMENTAL_LOADER_FLAG;
5608
- exports.FEATURE_TYPESCRIPT_NODE_VERSION = FEATURE_TYPESCRIPT_NODE_VERSION;
5609
- exports.IMPORT_FLAG = IMPORT_FLAG;
5610
- exports.IMPORT_FLAG_SUPPORTED = IMPORT_FLAG_SUPPORTED;
5611
- exports.INT32_BYTES = INT32_BYTES;
5612
- exports.LOADER_FLAG = LOADER_FLAG;
5613
- exports.LOADER_FLAGS = LOADER_FLAGS;
5614
- exports.MODULE_REGISTER_SUPPORTED = MODULE_REGISTER_SUPPORTED;
5615
- exports.MTS_SUPPORTED = MTS_SUPPORTED;
5616
- exports.NODE_OPTIONS = NODE_OPTIONS;
5617
- exports.NODE_VERSION = NODE_VERSION;
5618
- exports.NO_STRIP_TYPES = NO_STRIP_TYPES;
5619
- exports.NO_STRIP_TYPES_FLAG = NO_STRIP_TYPES_FLAG;
5620
- exports.REQUIRE_ABBR_FLAG = REQUIRE_ABBR_FLAG;
5621
- exports.REQUIRE_FLAG = REQUIRE_FLAG;
5622
- exports.REQUIRE_FLAGS = REQUIRE_FLAGS;
5623
- exports.STRIP_TYPES_FLAG = STRIP_TYPES_FLAG;
5624
- exports.STRIP_TYPES_NODE_VERSION = STRIP_TYPES_NODE_VERSION;
5625
- exports.TRANSFORM_TYPES_FLAG = TRANSFORM_TYPES_FLAG;
5626
- exports.TRANSFORM_TYPES_NODE_VERSION = TRANSFORM_TYPES_NODE_VERSION;
5627
- exports.TS_ESM_PARTIAL_SUPPORTED = TS_ESM_PARTIAL_SUPPORTED;
5628
- exports.TsRunner = TsRunner;
5629
- exports._generateGlobals = _generateGlobals;
5630
- exports.compareNodeVersion = compareNodeVersion;
5631
- exports.compareVersion = compareVersion;
5632
- exports.createSyncFn = createSyncFn;
5633
- exports.dataUrl = dataUrl;
5634
- exports.encodeImportModule = encodeImportModule;
5635
- exports.extractProperties = extractProperties;
5636
- exports.generateGlobals = generateGlobals;
5637
- exports.hasFlag = hasFlag;
5638
- exports.hasImportFlag = hasImportFlag;
5639
- exports.hasLoaderFlag = hasLoaderFlag;
5640
- exports.hasRequireFlag = hasRequireFlag;
5641
- exports.isFile = isFile;
5642
- exports.md5Hash = md5Hash;
5643
- exports.overrideStdio = overrideStdio;
5644
- exports.parseVersion = parseVersion;
5645
- exports.runAsWorker = runAsWorker;
5646
- exports.setupTsRunner = setupTsRunner;
5647
- exports.startWorkerThread = startWorkerThread;
5648
- }
5649
- });
5650
-
5651
- // node_modules/eslint-plugin-prettier/eslint-plugin-prettier.js
5652
- var require_eslint_plugin_prettier = __commonJS({
5653
- "node_modules/eslint-plugin-prettier/eslint-plugin-prettier.js"(exports, module) {
5654
- "use strict";
5655
- var {
5656
- showInvisibles,
5657
- generateDifferences
5658
- } = require_prettier_linter_helpers();
5659
- var { name: name2, version: version2 } = require_package2();
5660
- var { INSERT, DELETE, REPLACE } = generateDifferences;
5661
- var prettierFormat;
5662
- var lineIndexesCache = /* @__PURE__ */ new WeakMap();
5663
- function getLocFromIndex(sourceCode, index) {
5664
- if (typeof sourceCode.getLocFromIndex === "function") {
5665
- return sourceCode.getLocFromIndex(index);
5666
- }
5667
- let lineIndexes = lineIndexesCache.get(sourceCode);
5668
- if (!lineIndexes) {
5669
- lineIndexes = [...sourceCode.text.matchAll(/\r?\n/g)].map(
5670
- (match) => match.index
5671
- );
5672
- lineIndexes.unshift(0);
5673
- lineIndexesCache.set(sourceCode, lineIndexes);
5674
- }
5675
- let line = 0;
5676
- while (line + 1 < lineIndexes.length && lineIndexes[line + 1] < index) {
5677
- line += 1;
5678
- }
5679
- const column = index - lineIndexes[line];
5680
- return { line: line + 1, column };
5681
- }
5682
- function reportDifference(context, difference) {
5683
- var _a;
5684
- const { operation, offset, deleteText = "", insertText = "" } = difference;
5685
- const range = [offset, offset + deleteText.length];
5686
- const sourceCode = (_a = context.sourceCode) != null ? _a : context.getSourceCode();
5687
- const [start, end] = range.map((index) => getLocFromIndex(sourceCode, index));
5688
- context.report({
5689
- messageId: operation,
5690
- data: {
5691
- deleteText: showInvisibles(deleteText),
5692
- insertText: showInvisibles(insertText)
5693
- },
5694
- loc: { start, end },
5695
- fix: (fixer) => fixer.replaceTextRange(range, insertText)
5696
- });
5697
- }
5698
- var eslintPluginPrettier = {
5699
- meta: { name: name2, version: version2 },
5700
- configs: {
5701
- recommended: {
5702
- extends: ["prettier"],
5703
- plugins: ["prettier"],
5704
- rules: {
5705
- "prettier/prettier": "error",
5706
- "arrow-body-style": "off",
5707
- "prefer-arrow-callback": "off"
5708
- }
5709
- }
5710
- },
5711
- rules: {
5712
- prettier: {
5713
- meta: {
5714
- docs: {
5715
- url: "https://github.com/prettier/eslint-plugin-prettier#options"
5716
- },
5717
- type: "layout",
5718
- fixable: "code",
5719
- schema: [
5720
- // Prettier options:
5721
- {
5722
- type: "object",
5723
- properties: {},
5724
- additionalProperties: true
5725
- },
5726
- {
5727
- type: "object",
5728
- properties: {
5729
- usePrettierrc: { type: "boolean" },
5730
- fileInfoOptions: {
5731
- type: "object",
5732
- properties: {},
5733
- additionalProperties: true
5734
- }
5735
- },
5736
- additionalProperties: true
5737
- }
5738
- ],
5739
- messages: {
5740
- [INSERT]: "Insert `{{ insertText }}`",
5741
- [DELETE]: "Delete `{{ deleteText }}`",
5742
- [REPLACE]: "Replace `{{ deleteText }}` with `{{ insertText }}`"
5743
- }
5744
- },
5745
- create(context) {
5746
- var _a, _b, _c;
5747
- const options = (
5748
- /** @type {Options | undefined} */
5749
- context.options[1]
5750
- );
5751
- const usePrettierrc = !options || options.usePrettierrc !== false;
5752
- const fileInfoOptions = (options == null ? void 0 : options.fileInfoOptions) || {};
5753
- const sourceCode = (
5754
- /** @type {SourceCode} */
5755
- (_a = context.sourceCode) != null ? _a : context.getSourceCode()
5756
- );
5757
- const filepath = (_b = context.filename) != null ? _b : context.getFilename();
5758
- const onDiskFilepath = (_c = context.physicalFilename) != null ? _c : context.getPhysicalFilename();
5759
- const source = sourceCode.text;
5760
- return {
5761
- /** @param {unknown} node */
5762
- [sourceCode.ast.type](node) {
5763
- var _a2, _b2;
5764
- if (!prettierFormat) {
5765
- prettierFormat = /** @type {PrettierFormat} */
5766
- require_lib2().createSyncFn(__require.resolve("./worker.mjs"));
5767
- }
5768
- const eslintPrettierOptions = context.options[0] || {};
5769
- const parser = (
5770
- /** @type {Linter.Parser | undefined} */
5771
- (_a2 = context.languageOptions) == null ? void 0 : _a2.parser
5772
- );
5773
- let prettierSource;
5774
- try {
5775
- prettierSource = prettierFormat(
5776
- source,
5777
- __spreadProps(__spreadValues({}, eslintPrettierOptions), {
5778
- filepath,
5779
- onDiskFilepath,
5780
- parserMeta: parser && ((_b2 = parser.meta) != null ? _b2 : {
5781
- name: parser.name,
5782
- version: parser.version
5783
- }),
5784
- parserPath: context.parserPath,
5785
- usePrettierrc
5786
- }),
5787
- fileInfoOptions
5788
- );
5789
- } catch (err) {
5790
- if (!(err instanceof SyntaxError)) {
5791
- throw err;
5792
- }
5793
- let message = "Parsing error: " + err.message;
5794
- const error = (
5795
- /**
5796
- * @type {SyntaxError & {
5797
- * codeFrame: string;
5798
- * loc?: AST.SourceLocation;
5799
- * }}
5800
- */
5801
- err
5802
- );
5803
- if (error.codeFrame) {
5804
- message = message.replace(`
5805
- ${error.codeFrame}`, "");
5806
- }
5807
- if (error.loc) {
5808
- message = message.replace(/ \(\d+:\d+\)$/, "");
5809
- context.report({ message, loc: error.loc });
5810
- } else {
5811
- context.report({ message, node });
5812
- }
5813
- return;
5814
- }
5815
- if (prettierSource == null) {
5816
- return;
5817
- }
5818
- if (source !== prettierSource) {
5819
- const differences = generateDifferences(source, prettierSource);
5820
- for (const difference of differences) {
5821
- reportDifference(
5822
- /** @type {Rule.RuleContext} */
5823
- context,
5824
- difference
5825
- );
5826
- }
5827
- }
5828
- }
5829
- };
5830
- }
5831
- }
5832
- }
5833
- };
5834
- module.exports = eslintPluginPrettier;
5835
- }
5836
- });
5837
-
5838
3693
  // package.json
5839
3694
  var name = "@alextheman/eslint-plugin";
5840
- var version = "1.2.5";
3695
+ var version = "1.2.6";
5841
3696
 
5842
3697
  // src/create-rule.ts
5843
3698
  import { ESLintUtils } from "@typescript-eslint/utils";
@@ -5970,18 +3825,18 @@ var rules_default = {
5970
3825
  // eslint.config.ts
5971
3826
  var import_js = __toESM(require_src(), 1);
5972
3827
  var import_globals = __toESM(require_globals2(), 1);
5973
- var import_eslint_config_prettier = __toESM(require_eslint_config_prettier(), 1);
5974
- var import_eslint_plugin_prettier = __toESM(require_eslint_plugin_prettier(), 1);
5975
3828
  import eslintPlugin from "@typescript-eslint/eslint-plugin";
5976
3829
  import tsparser from "@typescript-eslint/parser";
5977
3830
  import importPlugin from "eslint-plugin-import";
3831
+ import prettierConfig from "eslint-config-prettier";
3832
+ import prettierPlugin from "eslint-plugin-prettier";
5978
3833
  var warnOnFixButErrorOnLint = (
5979
3834
  // eslint-disable-next-line no-undef
5980
3835
  process.env.ESLINT_MODE === "fix" ? "warn" : "error"
5981
3836
  );
5982
3837
  var eslint_config_default = [
5983
3838
  import_js.default.configs.recommended,
5984
- import_eslint_config_prettier.default,
3839
+ prettierConfig,
5985
3840
  {
5986
3841
  name: "@alextheman/eslint-config-typescript-base",
5987
3842
  files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
@@ -6003,7 +3858,7 @@ var eslint_config_default = [
6003
3858
  plugins: {
6004
3859
  "@typescript-eslint": eslintPlugin,
6005
3860
  import: importPlugin,
6006
- prettier: import_eslint_plugin_prettier.default
3861
+ prettier: prettierPlugin
6007
3862
  },
6008
3863
  rules: {
6009
3864
  "import/no-unresolved": warnOnFixButErrorOnLint,