Website Structure
This commit is contained in:
parent
62812f2090
commit
71f0676a62
22365 changed files with 4265753 additions and 791 deletions
52
Frontend-Learner/node_modules/vite-plugin-checker/dist/codeFrame.js
generated
vendored
Normal file
52
Frontend-Learner/node_modules/vite-plugin-checker/dist/codeFrame.js
generated
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import os from "node:os";
|
||||
import { codeFrameColumns } from "@babel/code-frame";
|
||||
function createFrame(source, location) {
|
||||
return codeFrameColumns(source, location, {
|
||||
// worker tty did not fork parent process stdout, let's make a workaround
|
||||
forceColor: true
|
||||
}).split("\n").map((line) => ` ${line}`).join(os.EOL);
|
||||
}
|
||||
function tsLikeLocToBabelLoc(tsLoc) {
|
||||
return {
|
||||
start: { line: tsLoc.start.line + 1, column: tsLoc.start.character + 1 },
|
||||
end: { line: tsLoc.end.line + 1, column: tsLoc.end.character + 1 }
|
||||
};
|
||||
}
|
||||
function lineColLocToBabelLoc(d) {
|
||||
return {
|
||||
start: { line: d.line, column: d.column },
|
||||
end: { line: d.endLine || 0, column: d.endColumn }
|
||||
};
|
||||
}
|
||||
function offsetRangeToBabelLocation(source, offset, length) {
|
||||
const defaultPos = { line: 1, column: 1 };
|
||||
if (!source || source.length === 0) {
|
||||
return { start: { ...defaultPos }, end: { ...defaultPos } };
|
||||
}
|
||||
const startIndex = offset;
|
||||
const endIndex = offset + length;
|
||||
let line = 1;
|
||||
let column = 1;
|
||||
let start = null;
|
||||
for (let i = 0; i < endIndex; i++) {
|
||||
if (i === startIndex) {
|
||||
start = { line, column };
|
||||
}
|
||||
if (source[i] === "\n") {
|
||||
line++;
|
||||
column = 1;
|
||||
} else {
|
||||
column++;
|
||||
}
|
||||
}
|
||||
start ?? (start = { line, column });
|
||||
const end = { line, column };
|
||||
return { start, end };
|
||||
}
|
||||
export {
|
||||
createFrame,
|
||||
lineColLocToBabelLoc,
|
||||
offsetRangeToBabelLocation,
|
||||
tsLikeLocToBabelLoc
|
||||
};
|
||||
//# sourceMappingURL=codeFrame.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue