Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions hooks/modify-java-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,18 +480,18 @@ async function main() {
}

function getConstructorRegex(filename) {
return new RegExp(`([^]*${filename.split('.')[0]}\\s*\\(.*\\)\\s*{[^}]*})([^]*)`, 'm');
return new RegExp(`([^]*?${filename.split('.')[0]}\\s*\\(.*?\\)\\s*{[^}]*})([^]*)`, 'm');
}

function getInterfaceDeclarationRegex(filename) {
return new RegExp(`([^]*interface\\s+${filename.split('.')[0]}[\\s\\w]*{)([^]*})`, 'm');
return new RegExp(`([^]*?interface\\s+${filename.split('.')[0]}[\\s\\w]*{)([^]*})`, 'm');
}

function getClassDeclarationRegex(filename) {
return new RegExp(`([^]*class\\s+${filename.split('.')[0]}[\\s\\w]*{)([^]*})`, 'm');
return new RegExp(`([^]*?class\\s+${filename.split('.')[0]}[\\s\\w]*{)([^]*})`, 'm');
}

function removeComments(content) {
return content.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, '');
return content.replace(/\/\*[^]*?\*\/|([^\\:]|^)\/\/.*$/gm, '');
}
}
2 changes: 1 addition & 1 deletion rspack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ module.exports = (env, options) => {
},
// Regular CSS/SCSS files
{
test: /(?<!\.m)\.(sa|sc|c)ss$/,
test: /\.(?<!\.m\.)(sa|sc|c)ss$/,
type: 'javascript/auto',
use: [
rspack.CssExtractRspackPlugin.loader,
Expand Down
4 changes: 2 additions & 2 deletions src/cm/lsp/clientManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ function normalizeRootUriForServer(
if (!rootUri || typeof rootUri !== "string") {
return { normalizedRootUri: null, originalRootUri: null };
}
const schemeMatch = /^([a-zA-Z][\w+\-.]*):/.exec(rootUri);
const schemeMatch = /^([a-zA-Z][\w+\-.]*?):/.exec(rootUri);
const scheme = schemeMatch ? schemeMatch[1].toLowerCase() : null;

// Already a file:// URI - use as-is
Expand All @@ -1206,7 +1206,7 @@ function normalizeRootUriForServer(
function normalizeDocumentUri(uri: string | null | undefined): string | null {
if (!uri || typeof uri !== "string") return null;

const schemeMatch = /^([a-zA-Z][\w+\-.]*):/.exec(uri);
const schemeMatch = /^([a-zA-Z][\w+\-.]*?):/.exec(uri);
const scheme = schemeMatch ? schemeMatch[1].toLowerCase() : null;

// Already a file:// URI or untitled use as-is
Expand Down
4 changes: 2 additions & 2 deletions src/cm/lsp/runtimeProviders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export function inferWorkspaceKind(
const uri = String(context.rootUri || context.file?.uri || context.uri || "");
if (!uri) return "unknown";

const schemeMatch = /^([a-zA-Z][\w+\-.]*):/.exec(uri);
const schemeMatch = /^([a-zA-Z][\w+\-.]*?):/.exec(uri);
const scheme = schemeMatch ? schemeMatch[1].toLowerCase() : null;

if (!scheme) return uri.startsWith("/") ? "app-private" : "unknown";
Expand Down Expand Up @@ -198,7 +198,7 @@ export function isBuiltinAlpineAccessible(
const uri = String(context.rootUri || context.file?.uri || context.uri || "");
if (!uri) return false;

const schemeMatch = /^([a-zA-Z][\w+\-.]*):/.exec(uri);
const schemeMatch = /^([a-zA-Z][\w+\-.]*?):/.exec(uri);
const scheme = schemeMatch ? schemeMatch[1].toLowerCase() : null;

if (!scheme) return uri.startsWith("/");
Expand Down
2 changes: 1 addition & 1 deletion src/cm/modelist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export class Mode {
const regexParts: string[] = [];

if (extensionPatterns.length) {
regexParts.push(`^.*\\.(${extensionPatterns.join("|")})$`);
regexParts.push(`^.*?\\.(${extensionPatterns.join("|")})$`);
}

regexParts.push(...filenamePatterns);
Expand Down
2 changes: 1 addition & 1 deletion src/fileSystem/sftp.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ class SftpClient {
* @param {String} name
*/
#safeName(name) {
const escapeCh = (str) => str.replace(/\\([\s\S])|([`"])/g, "\\$1$2");
const escapeCh = (str) => str.replace(/\\([^])|([`"])/g, "\\$1$2");
const ar = name.split("/");
return ar.map((dirname) => escapeCh(dirname)).join("/");
}
Expand Down
6 changes: 3 additions & 3 deletions src/lib/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ import loadPolyFill from "utils/polyfill";
* @returns {IterableIterator<RegExpMatchArray>}
*/
function matchRegex(str) {
return str.matchAll(/(?<!%)%[oOsdifc]/g);
return str.matchAll(/%(?<!%%)[oOsdifc]/g);
}
}

Expand All @@ -605,10 +605,10 @@ import loadPolyFill from "utils/polyfill";
}
let stack = error.stack.split("\n");
if (!skip) stack.splice(1, 1);
let regExecRes = /<(.*)>:(\d+):(\d+)/.exec(stack[1]) || [];
let regExecRes = /<([^>]*)>:(\d+):(\d+)/.exec(stack[1]) || [];
if (!regExecRes.length) {
const errorInfo = stack[1]?.split("/").pop();
regExecRes = /(.+):(\d+):(\d+)/.exec(errorInfo) || [];
regExecRes = /(.+?):(\d+):(\d+)/.exec(errorInfo) || [];
}
let src = "";
const location = regExecRes[1];
Expand Down
2 changes: 1 addition & 1 deletion src/lib/editorFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ export default class EditorFile {
let text = this.session.doc.toString();

if (value === "windows") {
text = text.replace(/(?<!\r)\n/g, "\r\n");
text = text.replace(/\n(?<!\r\n)/g, "\r\n");
} else {
Comment thread
Palloxin marked this conversation as resolved.
text = text.replace(/\r/g, "");
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/changelog/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default async function Changelog() {
`[#$1](${REPO_URL}/pull/$1)`,
)
// Convert existing #number references to links if they aren't already
.replace(/(?<!\[)#(\d+)(?!\])/g, `[#$1](${REPO_URL}/pull/$1)`)
.replace(/#(?<!\[#)(\d+)(?!\])/g, `[#$1](${REPO_URL}/pull/$1)`)
// Convert @username mentions to GitHub profile links
.replace(/@(\w+)/g, "[@$1](https://github.com/$1)");

Expand Down
4 changes: 2 additions & 2 deletions src/pages/markdownPreview/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import Url from "utils/Url";
const EXTERNAL_LINK_PATTERN = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
const IMAGE_PLACEHOLDER =
"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
const BLOCK_MATH_PATTERN = /(^|[^\\])\$\$[\s\S]+?\$\$/m;
const BLOCK_MATH_PATTERN = /(^|[^\\])\$\$[^]+?\$\$/m;
const INLINE_MATH_PATTERN =
/(^|[^\\])\$(?!\s)(?:\\.|[^$\\\n])*(?:\\[{^_(]|[{^_])(?:\\.|[^$\\\n])*\$(?!\w)/m;
const BEGIN_END_MATH_PATTERN =
/\\begin\{(?:equation|align|gather|multline|eqnarray)\*?\}[\s\S]*?\\end\{(?:equation|align|gather|multline|eqnarray)\*?\}/m;
/\\begin\{(?:equation|align|gather|multline|eqnarray)\*?\}[^]*?\\end\{(?:equation|align|gather|multline|eqnarray)\*?\}/m;

let mathModulesPromise = null;
let mathMarkdownItPromise = null;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/sponsor/sponsor.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ async function handlePurchase(productId, title) {
id: "email",
type: "email",
match:
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+?"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
},
...extraFields,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function installWindows(windowsPath) {

// Replace <Content Include="strings\buildinfo.resjson"> to <PRIResource Include="strings\buildinfo.resjson">
if (projitems.match(/<ItemGroup>[\s]*?<Content +.*?Include="strings\/buildinfo.resjson".+/m)) {
const search = /<ItemGroup>[\s]*?<Content +.*?Include="strings\/buildinfo.resjson"[\s\S]*?<\/ItemGroup>/m;
const search = /<ItemGroup>[\s]*?<Content +.*?Include="strings\/buildinfo.resjson"[^]*?<\/ItemGroup>/m;

const replace
= "<ItemGroup>\r\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function uninstallWindows(context, windowsPath) {
// Replace <PRIResource Include="strings\buildinfo.resjson"> to <Content Include="strings\buildinfo.resjson">
if (projitems.match(/<ItemGroup>[\s]*?<PRIResource +.*?Include="strings\/buildinfo.resjson".+/m)) {

const search = /<ItemGroup>[\s]*?<PRIResource +.*?Include="strings\/buildinfo.resjson"[\s\S]*?<\/ItemGroup>/m;
const search = /<ItemGroup>[\s]*?<PRIResource +.*?Include="strings\/buildinfo.resjson"[^]*?<\/ItemGroup>/m;

const replace
= "<ItemGroup>\r\n"
Expand All @@ -47,9 +47,9 @@ function uninstallWindows(context, windowsPath) {
}

// Remove <Target Name="BuildInfo_Timestamp" BeforeTargets=BeforeBuild">
if (projitems.match(/<Target +.*Name="BuildInfo_Timestamp".*/)) {
if (projitems.match(/<Target +.*?Name="BuildInfo_Timestamp".*/)) {

const search = /[\r\n ]*<Target +.*Name="BuildInfo_Timestamp"[\s\S]*?<\/Target>/gm;
const search = /[\r\n ]*<Target +.*?Name="BuildInfo_Timestamp"[^]*?<\/Target>/gm;

projitems = projitems.replace(search, '');
changed = true;
Expand Down
2 changes: 1 addition & 1 deletion utils/scripts/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ async function applyPluginUpdates() {
}

const xml = fs.readFileSync(pluginXml, "utf8");
const idMatch = /<plugin[^>]*\sid=["']([^"']+)["']/.exec(xml);
const idMatch = /<plugin[^>]*?\sid=["']([^"']+)["']/.exec(xml);
const pluginId = idMatch?.[1];
if (!pluginId) {
log("warn", `Could not find plugin id in ${dir}/plugin.xml`);
Expand Down
2 changes: 1 addition & 1 deletion utils/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function isPaidVersion() {
});
}

const widgetId = /<widget[^>]*\sid=["']([^"']+)["']/.exec(config)?.[1];
const widgetId = /<widget[^>]*?\sid=["']([^"']+)["']/.exec(config)?.[1];

return widgetId === ID_PAID;
}
Expand Down