From e9835173386714f6e281b28c2a2a94f110daab8c Mon Sep 17 00:00:00 2001 From: Andrew Marcuse Date: Tue, 29 Oct 2024 21:10:46 -0400 Subject: [PATCH] Engine structure tweaks --- src/app/internal/list.html/page.tsx | 39 +++++++++++++++++++++++++++++ src/app/robots.txt/route.ts | 3 ++- src/components/Level.tsx | 19 ++++++++++++++ src/components/TestResults.tsx | 2 +- src/engines/RegexEngine.ts | 2 +- src/engines/browser.ts | 4 +-- src/engines/bun.ts | 5 ++-- src/engines/deno.ts | 5 ++-- src/engines/dotnet.ts | 2 ++ src/engines/empty.ts | 2 +- src/engines/erlang.ts | 1 + src/engines/go.ts | 3 +-- src/engines/haskell.ts | 5 ++-- src/engines/java.ts | 3 +-- src/engines/mysql.ts | 1 + src/engines/nodejs.ts | 3 +-- src/engines/perl.ts | 3 +-- src/engines/php.ts | 5 ++-- src/engines/postgresql.ts | 5 ++-- src/engines/python.ts | 3 +-- src/engines/ruby.ts | 5 ++-- src/engines/rust.ts | 5 ++-- src/engines/swift.ts | 3 +-- src/engines/tcl.ts | 3 +-- src/engines/xregexp.ts | 3 +-- src/types/EngineStatus.ts | 1 + 26 files changed, 92 insertions(+), 43 deletions(-) create mode 100644 src/app/internal/list.html/page.tsx create mode 100644 src/components/Level.tsx diff --git a/src/app/internal/list.html/page.tsx b/src/app/internal/list.html/page.tsx new file mode 100644 index 0000000..90496ee --- /dev/null +++ b/src/app/internal/list.html/page.tsx @@ -0,0 +1,39 @@ +import { Level } from '@/components/Level'; +import { getEngines } from '@/engines'; + + + +export default function List() { + + const rows = getEngines().map((engine) => { + return ({engine.short_name}); + }); + + const total = getEngines().length; + const working = getEngines().filter(engine => engine.test_url).length; + + return ( + <> +

Engines

+ + + + + + + + + {rows} + +
NameLevel
+

+ : {getEngines().filter(engine => engine.level === 'alpha').length}
+ : {getEngines().filter(engine => engine.level === 'beta').length}
+ : {getEngines().filter(engine => engine.level === 'golden').length}
+ Total working: {working}
+ : {getEngines().filter(engine => engine.level === 'notimplemented').length}
+ Grand total: {total} +

+ + ); +} \ No newline at end of file diff --git a/src/app/robots.txt/route.ts b/src/app/robots.txt/route.ts index e78e244..032a3b8 100644 --- a/src/app/robots.txt/route.ts +++ b/src/app/robots.txt/route.ts @@ -14,8 +14,9 @@ Disallow: / Sitemap: https://www.regexplanet.com/sitemap.xml User-agent: * +Disallow: /int Disallow: /honeypot.txt -` +`; } return new Response(robotsTxt, { diff --git a/src/components/Level.tsx b/src/components/Level.tsx new file mode 100644 index 0000000..4639d75 --- /dev/null +++ b/src/components/Level.tsx @@ -0,0 +1,19 @@ +type LevelProps = { + level: string; +} + +export function Level({ level }: LevelProps) { + if (level === 'alpha') { + return ({level}); + } + if (level === 'beta') { + return ({level}); + } + if (level === 'golden') { + return ({level}); + } + if (level === 'notimplemented') { + return ((not implemented yet)); + } + return (<>{level}) +} diff --git a/src/components/TestResults.tsx b/src/components/TestResults.tsx index 30449de..8911c49 100644 --- a/src/components/TestResults.tsx +++ b/src/components/TestResults.tsx @@ -11,7 +11,7 @@ export function TestResults({ onClear, testOutput }: props) { return ( <>

Results

- { testOutput.message ?
{testOutput.message}
: <>} + { testOutput.message && testOutput.message != "OK" ?
{testOutput.message}
: <>} { testOutput.html ?
: <> }
diff --git a/src/engines/RegexEngine.ts b/src/engines/RegexEngine.ts index c19cea6..d85fa53 100644 --- a/src/engines/RegexEngine.ts +++ b/src/engines/RegexEngine.ts @@ -27,7 +27,7 @@ export type RegexEngine = { links: Record; // A map of (name: url) for other help links. These will be displayed on the support page under “Official Documentation” logo_icon: string; // SVG icon (just the logo, no text) in a square logo_ar21: string; // SVG logo (including language name) in a 2:1 aspect ratio - nodeping_url?: string; // URL of the nodeping status page + nodeping_id: string; // ID of the nodeping status check notfound?: string[]; // A list of handles that this is a substitute for (i.e. nodejs is a substitute for javascript) options: RegexOption[]; // A list of which options it supports. option_notes?: string; // Notes to display on the options page (html allowed) diff --git a/src/engines/browser.ts b/src/engines/browser.ts index 8e6fd88..fac8d66 100644 --- a/src/engines/browser.ts +++ b/src/engines/browser.ts @@ -7,11 +7,11 @@ export const browser: RegexEngine = { help_url: "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp", handle: "browser", - level: "alpha", + level: "golden", links: {}, logo_icon: "/images/browsers/browser-icon.svg", logo_ar21: "/images/browsers/browser-ar21.svg", - nodeping_url: undefined, + nodeping_id: "N/A", notfound: ["javascript", "typescript"], options: [ { diff --git a/src/engines/bun.ts b/src/engines/bun.ts index 5d21ab2..af91498 100644 --- a/src/engines/bun.ts +++ b/src/engines/bun.ts @@ -7,7 +7,7 @@ export const bun: RegexEngine = { help_url: "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp", handle: "bun", - level: "beta", + level: "golden", links: { "MDN RegExp Object": "https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/RegExp", @@ -16,8 +16,7 @@ export const bun: RegexEngine = { }, logo_icon: "https://www.vectorlogo.zone/logos/bunsh/bunsh-icon.svg", logo_ar21: "https://www.vectorlogo.zone/logos/bunsh/bunsh-ar21.svg", - nodeping_url: - "https://nodeping.com/reports/checks/iajucfo0-kq0e-47ql-82sk-xoji0l2ejmfw", + nodeping_id: "iajucfo0-kq0e-47ql-82sk-xoji0l2ejmfw", notfound: ["javascript", "typescript"], options: [ { diff --git a/src/engines/deno.ts b/src/engines/deno.ts index 6f5d972..470fea3 100644 --- a/src/engines/deno.ts +++ b/src/engines/deno.ts @@ -7,7 +7,7 @@ export const deno: RegexEngine = { help_url: "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp", handle: "deno", - level: "beta", + level: "golden", links: { "MDN RegExp Object": "https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/RegExp", @@ -16,8 +16,7 @@ export const deno: RegexEngine = { }, logo_icon: "https://www.vectorlogo.zone/logos/deno/deno-icon.svg", logo_ar21: "https://www.vectorlogo.zone/logos/deno/deno-ar21.svg", - nodeping_url: - "https://nodeping.com/reports/checks/iajucfo0-kq0e-47ql-82sk-xoji0l2ejmfw", + nodeping_id: "9z4pmj0b-ve3m-42s9-8s07-6c53rlel69iy", notfound: ["javascript", "typescript"], options: [ { diff --git a/src/engines/dotnet.ts b/src/engines/dotnet.ts index 6a76aa9..28a72bb 100644 --- a/src/engines/dotnet.ts +++ b/src/engines/dotnet.ts @@ -20,8 +20,10 @@ export const dotnet: RegexEngine = { }, logo_icon: "https://www.vectorlogo.zone/logos/dotnet/dotnet-icon.svg", logo_ar21: "https://www.vectorlogo.zone/logos/dotnet/dotnet-ar21.svg", + nodeping_id: "9z4pmj0b-ve3m-42s9-8s07-6c53rlel69iy", options: [], short_name: ".NET", + source_url: "https://github.com/regexplanet/regexplanet-dotnet", status_url: "https://dotnet.gcr.regexplanet.com/status.json", test_url: "https://dotnet.gcr.regexplanet.com/test.json", }; diff --git a/src/engines/empty.ts b/src/engines/empty.ts index 3b86fd9..4585bd9 100644 --- a/src/engines/empty.ts +++ b/src/engines/empty.ts @@ -10,7 +10,7 @@ export const LATER: RegexEngine = { links: {}, logo_icon: "https://www.vectorlogo.zone/logos/LATER/LATER-icon.svg", logo_ar21: "https://www.vectorlogo.zone/logos/LATER/LATER-ar21.svg", - nodeping_url: "https://nodeping.com/reports/checks/LATER", + nodeping_id: "LATER", options: [], short_name: "LATER", source_url: "https://github.com/regexplanet/regexplanet-LATER", diff --git a/src/engines/erlang.ts b/src/engines/erlang.ts index 552ef0a..030f159 100644 --- a/src/engines/erlang.ts +++ b/src/engines/erlang.ts @@ -10,6 +10,7 @@ export const erlang: RegexEngine = { links: {}, logo_ar21: "https://www.vectorlogo.zone/logos/erlang/erlang-ar21.svg", logo_icon: "https://www.vectorlogo.zone/logos/erlang/erlang-icon.svg", + nodeping_id: "LATER", options: [], short_name: "Erlang", }; diff --git a/src/engines/go.ts b/src/engines/go.ts index d4d9a41..ab8cd0b 100644 --- a/src/engines/go.ts +++ b/src/engines/go.ts @@ -10,8 +10,7 @@ export const go: RegexEngine = { links: { "re2 syntax": "http://code.google.com/p/re2/wiki/Syntax" }, logo_icon: "https://www.vectorlogo.zone/logos/golang/golang-icon.svg", logo_ar21: "https://www.vectorlogo.zone/logos/golang/golang-ar21.svg", - nodeping_url: - "https://nodeping.com/reports/checks/cvdmibs4-lyts-48bp-8l93-a4y3ihfrkncc", + nodeping_id: "cvdmibs4-lyts-48bp-8l93-a4y3ihfrkncc", options: [ { code: "posix", diff --git a/src/engines/haskell.ts b/src/engines/haskell.ts index 5e0bb58..b7845ec 100644 --- a/src/engines/haskell.ts +++ b/src/engines/haskell.ts @@ -3,13 +3,12 @@ import type { RegexEngine } from "./RegexEngine"; export const haskell: RegexEngine = { description: "Text.Regex", enabled: false, - level: "alpha", + level: "notimplemented", handle: "haskell", help_label: "Text.Regex", help_url: "http://hackage.haskell.org/package/regex-compat-0.95.1/docs/Text-Regex.html", - nodeping_url: - "https://nodeping.com/reports/checks/kt5c4lp3-80p5-4rzk-8nq2-kqtyvq4p1a2d", + nodeping_id: "kt5c4lp3-80p5-4rzk-8nq2-kqtyvq4p1a2d", links: { haskellwiki: "http://www.haskell.org/haskellwiki/Regular_expressions", "Text.Regex.TDFA": diff --git a/src/engines/java.ts b/src/engines/java.ts index f2e8c4b..157c1e6 100644 --- a/src/engines/java.ts +++ b/src/engines/java.ts @@ -11,8 +11,7 @@ export const java: RegexEngine = { links: {}, logo_icon: "https://www.vectorlogo.zone/logos/java/java-icon.svg", logo_ar21: "https://www.vectorlogo.zone/logos/java/java-ar21.svg", - nodeping_url: - "https://nodeping.com/reports/checks/m84cfhq9-gk43-44r5-8mih-syzu6vp45tuk", + nodeping_id: "m84cfhq9-gk43-44r5-8mih-syzu6vp45tuk", notfound: ["kotlin"], options: [ { diff --git a/src/engines/mysql.ts b/src/engines/mysql.ts index e55f1ba..9e180e3 100644 --- a/src/engines/mysql.ts +++ b/src/engines/mysql.ts @@ -10,6 +10,7 @@ export const mysql: RegexEngine = { links: {}, logo_icon: "https://www.vectorlogo.zone/logos/mysql/mysql-icon.svg", logo_ar21: "https://www.vectorlogo.zone/logos/mysql/mysql-ar21.svg", + nodeping_id: "LATER", options: [], short_name: "MySQL", }; diff --git a/src/engines/nodejs.ts b/src/engines/nodejs.ts index ce8d33c..bd9eb64 100644 --- a/src/engines/nodejs.ts +++ b/src/engines/nodejs.ts @@ -17,8 +17,7 @@ export const nodejs: RegexEngine = { }, logo_ar21: "https://www.vectorlogo.zone/logos/nodejs/nodejs-ar21.svg", logo_icon: "https://www.vectorlogo.zone/logos/nodejs/nodejs-icon.svg", - nodeping_url: - "https://nodeping.com/reports/checks/9z4pmj0b-ve3m-42s9-8s07-6c53rlel69iy", + nodeping_id: "9z4pmj0b-ve3m-42s9-8s07-6c53rlel69iy", notfound: ["javascript", "typescript"], options: [ /*{ diff --git a/src/engines/perl.ts b/src/engines/perl.ts index 1c7c0b1..af37215 100644 --- a/src/engines/perl.ts +++ b/src/engines/perl.ts @@ -13,8 +13,7 @@ export const perl: RegexEngine = { }, logo_icon: "https://www.vectorlogo.zone/logos/perl/perl-icon.svg", logo_ar21: "https://www.vectorlogo.zone/logos/perl/perl-ar21.svg", - nodeping_url: - "https://nodeping.com/reports/checks/gkh86985-3ae2-4w7b-8opi-il8pki62v1ie", + nodeping_id: "gkh86985-3ae2-4w7b-8opi-il8pki62v1ie", options: [ { code: "m", diff --git a/src/engines/php.ts b/src/engines/php.ts index d48786c..9514798 100644 --- a/src/engines/php.ts +++ b/src/engines/php.ts @@ -6,15 +6,14 @@ export const php: RegexEngine = { help_label: "PCRE Overview", help_url: "http://www.php.net/manual/en/book.pcre.php", handle: "php", - level: "alpha", + level: "beta", links: { "Pattern Modifiers": "http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php", }, logo_icon: "https://www.vectorlogo.zone/logos/php/php-icon.svg", logo_ar21: "https://www.vectorlogo.zone/logos/php/php-ar21.svg", - nodeping_url: - "https://nodeping.com/reports/checks/tv5izwkj-w7m2-4epk-8l9i-2z8y36h0o1n1", + nodeping_id: "tv5izwkj-w7m2-4epk-8l9i-2z8y36h0o1n1", options: [ { code: "i", diff --git a/src/engines/postgresql.ts b/src/engines/postgresql.ts index 010fe93..ac5a855 100644 --- a/src/engines/postgresql.ts +++ b/src/engines/postgresql.ts @@ -7,15 +7,14 @@ export const postgresql: RegexEngine = { help_url: "https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-REGEXP", handle: "postgresql", - level: "alpha", + level: "golden", links: { Options: "https://www.postgresql.org/docs/current/functions-matching.html#POSIX-EMBEDDED-OPTIONS-TABLE", }, logo_icon: "https://www.vectorlogo.zone/logos/postgresql/postgresql-icon.svg", logo_ar21: "https://www.vectorlogo.zone/logos/postgresql/postgresql-ar21.svg", - nodeping_url: - "https://nodeping.com/reports/checks/43ytdj0n-jeiu-4zta-8ptc-wr7xmxztp5i8", + nodeping_id: "43ytdj0n-jeiu-4zta-8ptc-wr7xmxztp5i8", options: [ { code: "b", description: "rest of RE is a BRE" }, { diff --git a/src/engines/python.ts b/src/engines/python.ts index cc2a632..44703da 100644 --- a/src/engines/python.ts +++ b/src/engines/python.ts @@ -10,8 +10,7 @@ export const python: RegexEngine = { links: {}, logo_icon: "https://www.vectorlogo.zone/logos/python/python-icon.svg", logo_ar21: "https://www.vectorlogo.zone/logos/python/python-ar21.svg", - nodeping_url: - "https://nodeping.com/reports/checks/15fanuwl-znir-46nz-8542-fzsk4fg3zrvg", + nodeping_id: "15fanuwl-znir-46nz-8542-fzsk4fg3zrvg", options: [ //{ code: "A", legacyCode: "", numericCode: 256, description: "ASCII" }, { diff --git a/src/engines/ruby.ts b/src/engines/ruby.ts index e8d34de..f49d1bc 100644 --- a/src/engines/ruby.ts +++ b/src/engines/ruby.ts @@ -12,8 +12,7 @@ export const ruby: RegexEngine = { }, logo_icon: "https://www.vectorlogo.zone/logos/ruby-lang/ruby-lang-icon.svg", logo_ar21: "https://www.vectorlogo.zone/logos/ruby-lang/ruby-lang-ar21.svg", - nodeping_url: - "https://nodeping.com/reports/checks/e6od3bui-a5wl-49ff-8698-0cbtjc52rqw1", + nodeping_id: "e6od3bui-a5wl-49ff-8698-0cbtjc52rqw1", options: [ { code: "x", @@ -38,5 +37,5 @@ export const ruby: RegexEngine = { short_name: "Ruby", source_url: "https://github.com/regexplanet/regexplanet-ruby", status_url: "https://ruby.gcr.regexplanet.com/status.json", - test_url: "https://ruby.gcr.regexplanet.com/status.json", + test_url: "https://ruby.gcr.regexplanet.com/test.json", }; diff --git a/src/engines/rust.ts b/src/engines/rust.ts index 9880903..af8de32 100644 --- a/src/engines/rust.ts +++ b/src/engines/rust.ts @@ -6,7 +6,7 @@ export const rust: RegexEngine = { help_label: "docs.rs", help_url: "https://docs.rs/regex/latest/regex/", handle: "rust", - level: "alpha", + level: "golden", links: { "Struct regex::Regex": "https://docs.rs/regex/latest/regex/struct.Regex.html", @@ -15,8 +15,7 @@ export const rust: RegexEngine = { }, logo_icon: "https://www.vectorlogo.zone/logos/rust-lang/rust-lang-icon.svg", logo_ar21: "https://www.vectorlogo.zone/logos/rust-lang/rust-lang-ar21.svg", - nodeping_url: - "https://nodeping.com/reports/checks/ujhwq5rz-ozzd-4uj7-8jth-4osxplhcw4j2", + nodeping_id: "ujhwq5rz-ozzd-4uj7-8jth-4osxplhcw4j2", options: [], option_notes: `Rust supports options in the regex pattern and with separate calls to RegexBuilder.`, short_name: "Rust", diff --git a/src/engines/swift.ts b/src/engines/swift.ts index 2e94a0a..e610885 100644 --- a/src/engines/swift.ts +++ b/src/engines/swift.ts @@ -12,8 +12,7 @@ export const swift: RegexEngine = { }, logo_icon: "https://www.vectorlogo.zone/logos/swift/swift-icon.svg", logo_ar21: "https://www.vectorlogo.zone/logos/swift/swift-ar21.svg", - nodeping_url: - "https://nodeping.com/reports/checks/sd8rr8e8-0vw2-4cur-87tg-tnm9et6pc6w5", + nodeping_id: "sd8rr8e8-0vw2-4cur-87tg-tnm9et6pc6w5", options: [ { code: "anchorsMatchLineEndings", diff --git a/src/engines/tcl.ts b/src/engines/tcl.ts index bf91adc..69c2862 100644 --- a/src/engines/tcl.ts +++ b/src/engines/tcl.ts @@ -10,8 +10,7 @@ export const tcl: RegexEngine = { links: {}, logo_icon: "https://www.vectorlogo.zone/logos/tcl/tcl-icon.svg", logo_ar21: "https://www.vectorlogo.zone/logos/tcl/tcl-ar21.svg", - nodeping_url: - "https://nodeping.com/reports/checks/kk4u50sh-kave-4wwx-8f2i-74tgnum8szwa", + nodeping_id: "kk4u50sh-kave-4wwx-8f2i-74tgnum8szwa", options: [], short_name: "tcl", source_url: "https://github.com/regexplanet/regexplanet-tcl", diff --git a/src/engines/xregexp.ts b/src/engines/xregexp.ts index 8b1dcae..1d9360b 100644 --- a/src/engines/xregexp.ts +++ b/src/engines/xregexp.ts @@ -15,8 +15,7 @@ export const xregexp: RegexEngine = { }, logo_icon: "https://www.vectorlogo.zone/logos/xregexp/xregexp-icon.svg", logo_ar21: "https://www.vectorlogo.zone/logos/xregexp/xregexp-ar21.svg", - nodeping_url: - "https://nodeping.com/reports/checks/7ysrbqyo-38sg-44au-8j78-g6fpipl8sxho", + nodeping_id: "7ysrbqyo-38sg-44au-8j78-g6fpipl8sxho", notfound: ["javascript", "typescript"], options: [ { diff --git a/src/types/EngineStatus.ts b/src/types/EngineStatus.ts index 1f85823..8155783 100644 --- a/src/types/EngineStatus.ts +++ b/src/types/EngineStatus.ts @@ -1,6 +1,7 @@ type EngineStatus = { success: boolean; version?: string; + detail?: string; time_millis?: number; err?: Error; };