prism-code-editor
Version:
Lightweight, extensible code editor component for the web using Prism
32 lines (31 loc) • 960 B
JavaScript
import { l as a, i as t } from "../prismCore-5c7f03d0.js";
import "./javascript.js";
import "./clike.js";
var e = a.flow = a.extend("js", {});
t("flow", "keyword", {
type: [
{
pattern: /\b(?:[Bb]oolean|Function|[Nn]umber|[Ss]tring|[Ss]ymbol|any|mixed|null|void)\b/,
alias: "class-name"
}
]
});
e["function-variable"].pattern = /(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/i;
delete e.parameter;
t("flow", "operator", {
"flow-punctuation": {
pattern: /\{\||\|\}/,
alias: "punctuation"
}
});
Array.isArray(e.keyword) || (e.keyword = [e.keyword]);
e.keyword.unshift(
{
pattern: /(^|[^$]\b)(?:Class|declare|opaque|type)\b(?!\$)/,
lookbehind: !0
},
{
pattern: /(^|[^$]\B)\$(?:Diff|Enum|Exact|Keys|ObjMap|PropertyType|Record|Shape|Subtype|Supertype|await)\b(?!\$)/,
lookbehind: !0
}
);