astro-eslint-parser 0.13.1 → 0.13.2
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/lib/index.js +59 -48
- package/lib/index.mjs +59 -48
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -132,6 +132,64 @@ var TSService = class {
|
|
|
132
132
|
}
|
|
133
133
|
createWatch(tsconfigPath) {
|
|
134
134
|
const { ts } = this;
|
|
135
|
+
const createAbstractBuilder = (...args) => {
|
|
136
|
+
const [
|
|
137
|
+
rootNames,
|
|
138
|
+
options,
|
|
139
|
+
argHost,
|
|
140
|
+
oldProgram,
|
|
141
|
+
configFileParsingDiagnostics,
|
|
142
|
+
projectReferences
|
|
143
|
+
] = args;
|
|
144
|
+
const host = argHost;
|
|
145
|
+
if (!this.patchedHostSet.has(host)) {
|
|
146
|
+
this.patchedHostSet.add(host);
|
|
147
|
+
const getTargetSourceFile = (fileName, languageVersionOrOptions) => {
|
|
148
|
+
var _a;
|
|
149
|
+
if (this.currTarget.filePath === normalizeFileName(ts, fileName)) {
|
|
150
|
+
return (_a = this.currTarget).sourceFile ?? (_a.sourceFile = ts.createSourceFile(
|
|
151
|
+
this.currTarget.filePath,
|
|
152
|
+
this.currTarget.code,
|
|
153
|
+
languageVersionOrOptions,
|
|
154
|
+
true,
|
|
155
|
+
ts.ScriptKind.TSX
|
|
156
|
+
));
|
|
157
|
+
}
|
|
158
|
+
return null;
|
|
159
|
+
};
|
|
160
|
+
const original2 = {
|
|
161
|
+
getSourceFile: host.getSourceFile,
|
|
162
|
+
getSourceFileByPath: host.getSourceFileByPath
|
|
163
|
+
};
|
|
164
|
+
host.getSourceFile = (fileName, languageVersionOrOptions, ...args2) => {
|
|
165
|
+
const originalSourceFile = original2.getSourceFile.call(
|
|
166
|
+
host,
|
|
167
|
+
fileName,
|
|
168
|
+
languageVersionOrOptions,
|
|
169
|
+
...args2
|
|
170
|
+
);
|
|
171
|
+
return getTargetSourceFile(fileName, languageVersionOrOptions) ?? originalSourceFile;
|
|
172
|
+
};
|
|
173
|
+
host.getSourceFileByPath = (fileName, path6, languageVersionOrOptions, ...args2) => {
|
|
174
|
+
const originalSourceFile = original2.getSourceFileByPath.call(
|
|
175
|
+
host,
|
|
176
|
+
fileName,
|
|
177
|
+
path6,
|
|
178
|
+
languageVersionOrOptions,
|
|
179
|
+
...args2
|
|
180
|
+
);
|
|
181
|
+
return getTargetSourceFile(fileName, languageVersionOrOptions) ?? originalSourceFile;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
return ts.createAbstractBuilder(
|
|
185
|
+
rootNames,
|
|
186
|
+
options,
|
|
187
|
+
host,
|
|
188
|
+
oldProgram,
|
|
189
|
+
configFileParsingDiagnostics,
|
|
190
|
+
projectReferences
|
|
191
|
+
);
|
|
192
|
+
};
|
|
135
193
|
const watchCompilerHost = ts.createWatchCompilerHost(
|
|
136
194
|
tsconfigPath,
|
|
137
195
|
{
|
|
@@ -143,54 +201,7 @@ var TSService = class {
|
|
|
143
201
|
allowNonTsExtensions: true
|
|
144
202
|
},
|
|
145
203
|
ts.sys,
|
|
146
|
-
|
|
147
|
-
const host = argHost;
|
|
148
|
-
if (!this.patchedHostSet.has(host)) {
|
|
149
|
-
this.patchedHostSet.add(host);
|
|
150
|
-
const getTargetSourceFile = (fileName, languageVersionOrOptions) => {
|
|
151
|
-
var _a;
|
|
152
|
-
if (this.currTarget.filePath === normalizeFileName(ts, fileName)) {
|
|
153
|
-
return (_a = this.currTarget).sourceFile ?? (_a.sourceFile = ts.createSourceFile(
|
|
154
|
-
this.currTarget.filePath,
|
|
155
|
-
this.currTarget.code,
|
|
156
|
-
languageVersionOrOptions,
|
|
157
|
-
true,
|
|
158
|
-
ts.ScriptKind.TSX
|
|
159
|
-
));
|
|
160
|
-
}
|
|
161
|
-
return null;
|
|
162
|
-
};
|
|
163
|
-
const original2 = {
|
|
164
|
-
getSourceFile: host.getSourceFile,
|
|
165
|
-
getSourceFileByPath: host.getSourceFileByPath
|
|
166
|
-
};
|
|
167
|
-
host.getSourceFile = (fileName, languageVersionOrOptions, ...args) => {
|
|
168
|
-
return getTargetSourceFile(fileName, languageVersionOrOptions) ?? original2.getSourceFile.call(
|
|
169
|
-
host,
|
|
170
|
-
fileName,
|
|
171
|
-
languageVersionOrOptions,
|
|
172
|
-
...args
|
|
173
|
-
);
|
|
174
|
-
};
|
|
175
|
-
host.getSourceFileByPath = (fileName, path6, languageVersionOrOptions, ...args) => {
|
|
176
|
-
return getTargetSourceFile(fileName, languageVersionOrOptions) ?? original2.getSourceFileByPath.call(
|
|
177
|
-
host,
|
|
178
|
-
fileName,
|
|
179
|
-
path6,
|
|
180
|
-
languageVersionOrOptions,
|
|
181
|
-
...args
|
|
182
|
-
);
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
return ts.createAbstractBuilder(
|
|
186
|
-
rootNames,
|
|
187
|
-
options,
|
|
188
|
-
host,
|
|
189
|
-
oldProgram,
|
|
190
|
-
configFileParsingDiagnostics,
|
|
191
|
-
projectReferences
|
|
192
|
-
);
|
|
193
|
-
},
|
|
204
|
+
createAbstractBuilder,
|
|
194
205
|
(diagnostic) => {
|
|
195
206
|
throw new Error(formatDiagnostics(ts, [diagnostic]));
|
|
196
207
|
},
|
package/lib/index.mjs
CHANGED
|
@@ -98,6 +98,64 @@ var TSService = class {
|
|
|
98
98
|
}
|
|
99
99
|
createWatch(tsconfigPath) {
|
|
100
100
|
const { ts } = this;
|
|
101
|
+
const createAbstractBuilder = (...args) => {
|
|
102
|
+
const [
|
|
103
|
+
rootNames,
|
|
104
|
+
options,
|
|
105
|
+
argHost,
|
|
106
|
+
oldProgram,
|
|
107
|
+
configFileParsingDiagnostics,
|
|
108
|
+
projectReferences
|
|
109
|
+
] = args;
|
|
110
|
+
const host = argHost;
|
|
111
|
+
if (!this.patchedHostSet.has(host)) {
|
|
112
|
+
this.patchedHostSet.add(host);
|
|
113
|
+
const getTargetSourceFile = (fileName, languageVersionOrOptions) => {
|
|
114
|
+
var _a;
|
|
115
|
+
if (this.currTarget.filePath === normalizeFileName(ts, fileName)) {
|
|
116
|
+
return (_a = this.currTarget).sourceFile ?? (_a.sourceFile = ts.createSourceFile(
|
|
117
|
+
this.currTarget.filePath,
|
|
118
|
+
this.currTarget.code,
|
|
119
|
+
languageVersionOrOptions,
|
|
120
|
+
true,
|
|
121
|
+
ts.ScriptKind.TSX
|
|
122
|
+
));
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
};
|
|
126
|
+
const original2 = {
|
|
127
|
+
getSourceFile: host.getSourceFile,
|
|
128
|
+
getSourceFileByPath: host.getSourceFileByPath
|
|
129
|
+
};
|
|
130
|
+
host.getSourceFile = (fileName, languageVersionOrOptions, ...args2) => {
|
|
131
|
+
const originalSourceFile = original2.getSourceFile.call(
|
|
132
|
+
host,
|
|
133
|
+
fileName,
|
|
134
|
+
languageVersionOrOptions,
|
|
135
|
+
...args2
|
|
136
|
+
);
|
|
137
|
+
return getTargetSourceFile(fileName, languageVersionOrOptions) ?? originalSourceFile;
|
|
138
|
+
};
|
|
139
|
+
host.getSourceFileByPath = (fileName, path6, languageVersionOrOptions, ...args2) => {
|
|
140
|
+
const originalSourceFile = original2.getSourceFileByPath.call(
|
|
141
|
+
host,
|
|
142
|
+
fileName,
|
|
143
|
+
path6,
|
|
144
|
+
languageVersionOrOptions,
|
|
145
|
+
...args2
|
|
146
|
+
);
|
|
147
|
+
return getTargetSourceFile(fileName, languageVersionOrOptions) ?? originalSourceFile;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
return ts.createAbstractBuilder(
|
|
151
|
+
rootNames,
|
|
152
|
+
options,
|
|
153
|
+
host,
|
|
154
|
+
oldProgram,
|
|
155
|
+
configFileParsingDiagnostics,
|
|
156
|
+
projectReferences
|
|
157
|
+
);
|
|
158
|
+
};
|
|
101
159
|
const watchCompilerHost = ts.createWatchCompilerHost(
|
|
102
160
|
tsconfigPath,
|
|
103
161
|
{
|
|
@@ -109,54 +167,7 @@ var TSService = class {
|
|
|
109
167
|
allowNonTsExtensions: true
|
|
110
168
|
},
|
|
111
169
|
ts.sys,
|
|
112
|
-
|
|
113
|
-
const host = argHost;
|
|
114
|
-
if (!this.patchedHostSet.has(host)) {
|
|
115
|
-
this.patchedHostSet.add(host);
|
|
116
|
-
const getTargetSourceFile = (fileName, languageVersionOrOptions) => {
|
|
117
|
-
var _a;
|
|
118
|
-
if (this.currTarget.filePath === normalizeFileName(ts, fileName)) {
|
|
119
|
-
return (_a = this.currTarget).sourceFile ?? (_a.sourceFile = ts.createSourceFile(
|
|
120
|
-
this.currTarget.filePath,
|
|
121
|
-
this.currTarget.code,
|
|
122
|
-
languageVersionOrOptions,
|
|
123
|
-
true,
|
|
124
|
-
ts.ScriptKind.TSX
|
|
125
|
-
));
|
|
126
|
-
}
|
|
127
|
-
return null;
|
|
128
|
-
};
|
|
129
|
-
const original2 = {
|
|
130
|
-
getSourceFile: host.getSourceFile,
|
|
131
|
-
getSourceFileByPath: host.getSourceFileByPath
|
|
132
|
-
};
|
|
133
|
-
host.getSourceFile = (fileName, languageVersionOrOptions, ...args) => {
|
|
134
|
-
return getTargetSourceFile(fileName, languageVersionOrOptions) ?? original2.getSourceFile.call(
|
|
135
|
-
host,
|
|
136
|
-
fileName,
|
|
137
|
-
languageVersionOrOptions,
|
|
138
|
-
...args
|
|
139
|
-
);
|
|
140
|
-
};
|
|
141
|
-
host.getSourceFileByPath = (fileName, path6, languageVersionOrOptions, ...args) => {
|
|
142
|
-
return getTargetSourceFile(fileName, languageVersionOrOptions) ?? original2.getSourceFileByPath.call(
|
|
143
|
-
host,
|
|
144
|
-
fileName,
|
|
145
|
-
path6,
|
|
146
|
-
languageVersionOrOptions,
|
|
147
|
-
...args
|
|
148
|
-
);
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
return ts.createAbstractBuilder(
|
|
152
|
-
rootNames,
|
|
153
|
-
options,
|
|
154
|
-
host,
|
|
155
|
-
oldProgram,
|
|
156
|
-
configFileParsingDiagnostics,
|
|
157
|
-
projectReferences
|
|
158
|
-
);
|
|
159
|
-
},
|
|
170
|
+
createAbstractBuilder,
|
|
160
171
|
(diagnostic) => {
|
|
161
172
|
throw new Error(formatDiagnostics(ts, [diagnostic]));
|
|
162
173
|
},
|