@easyv/biz-components 1.0.28 → 1.0.29

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.
@@ -3,5 +3,8 @@ export interface CodeEditorProps {
3
3
  code: string;
4
4
  onChange: (v: string) => void;
5
5
  wrapperClassName?: string;
6
+ environment?: 'browser' | 'node';
7
+ placeholder?: string;
8
+ showLintGutter?: boolean;
6
9
  }
7
10
  export declare const CodeEditor: (props: CodeEditorProps) => JSX.Element;
@@ -1,37 +1,56 @@
1
1
  import { j as jsxRuntimeExports } from "../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
2
- import { javascript } from "../../node_modules/.pnpm/@codemirror_lang-javascript@6.2.1/node_modules/@codemirror/lang-javascript/dist/index.es.js";
2
+ import { javascript, javascriptLanguage } from "../../node_modules/.pnpm/@codemirror_lang-javascript@6.2.1/node_modules/@codemirror/lang-javascript/dist/index.es.js";
3
3
  import { json } from "../../node_modules/.pnpm/@codemirror_lang-json@6.0.1/node_modules/@codemirror/lang-json/dist/index.es.js";
4
4
  import { lintGutter, linter } from "../../node_modules/.pnpm/@codemirror_lint@6.5.0/node_modules/@codemirror/lint/dist/index.es.js";
5
+ import { placeholder } from "../../node_modules/.pnpm/@codemirror_view@6.38.0/node_modules/@codemirror/view/dist/index.es.js";
5
6
  import { tags } from "../../node_modules/.pnpm/@lezer_highlight@1.2.1/node_modules/@lezer/highlight/dist/index.es.js";
6
7
  import { abcdefInit } from "../../node_modules/.pnpm/@uiw_codemirror-theme-abcdef@4.24.1_@codemirror_language@6.11.0_@codemirror_state@6.5.2_@codemirror_view@6.38.0/node_modules/@uiw/codemirror-theme-abcdef/esm/index.es.js";
7
8
  import ReactCodeMirror from "../../node_modules/.pnpm/@uiw_react-codemirror@4.21.20_@babel_runtime@7.27.0_@codemirror_autocomplete@6.11.0_@co_23e4ab2dcd0b1efe365ce4b7a9046dac/node_modules/@uiw/react-codemirror/esm/index.es.js";
8
- import { parse } from "../../node_modules/.pnpm/acorn@8.15.0/node_modules/acorn/dist/acorn.es.js";
9
9
  import classNames from "../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js";
10
+ import { GLOBAL_OBJECT_COMPLETIONS } from "./constants.es.js";
11
+ import { lintJavaScriptCode } from "./utils.es.js";
10
12
  const CodeEditor = (props) => {
11
- const { languageMode, code, onChange, wrapperClassName } = props;
13
+ const {
14
+ languageMode,
15
+ code,
16
+ onChange,
17
+ wrapperClassName,
18
+ environment = "browser",
19
+ placeholder: placeholderText,
20
+ showLintGutter = false
21
+ } = props;
12
22
  const handleOnChange = (value) => {
13
23
  onChange == null ? void 0 : onChange(value);
14
24
  };
25
+ const createCustomCompletions = () => {
26
+ return (context) => {
27
+ const word = context.matchBefore(/\w*/);
28
+ if (!word) return null;
29
+ const line = context.state.doc.lineAt(context.pos);
30
+ const lineText = line.text;
31
+ const beforeCursor = lineText.slice(0, context.pos - line.from);
32
+ const memberMatch = beforeCursor.match(/(\w+)\.$/);
33
+ if (memberMatch) {
34
+ const objectName = memberMatch[1];
35
+ if (GLOBAL_OBJECT_COMPLETIONS[objectName]) {
36
+ return {
37
+ from: context.pos,
38
+ options: GLOBAL_OBJECT_COMPLETIONS[objectName].map((method) => ({
39
+ label: method,
40
+ type: "method",
41
+ info: `${objectName}.${method}()`,
42
+ apply: method
43
+ }))
44
+ };
45
+ }
46
+ }
47
+ return null;
48
+ };
49
+ };
15
50
  const createJSLinter = () => {
16
51
  return (view) => {
17
- const diagnostics = [];
18
52
  const code2 = view.state.doc.toString();
19
- console.log("%c 🐱 cat ==== createJSLinter:", "color: orange; font-size: 16px;", code2);
20
- try {
21
- parse(code2, { ecmaVersion: 2020 });
22
- } catch (error) {
23
- const { loc, message } = error;
24
- console.log("%c ❤️ love ==== js lint error:", "color: red; font-size: 16px;", { error });
25
- console.dir(error);
26
- const errorMsg = `语法错误:第 ${loc.line} 行,第 ${loc.column} 列 - ${message}`;
27
- diagnostics.push({
28
- from: loc.line,
29
- to: loc.line + 1,
30
- severity: "error",
31
- message: errorMsg
32
- });
33
- }
34
- return diagnostics;
53
+ return lintJavaScriptCode(code2, environment, view);
35
54
  };
36
55
  };
37
56
  const createJSONLinter = () => {
@@ -61,16 +80,22 @@ const CodeEditor = (props) => {
61
80
  };
62
81
  return fn;
63
82
  };
64
- const langExtension = languageMode === "javascript" ? javascript() : json();
83
+ const langExtension = languageMode === "javascript" ? [
84
+ javascript(),
85
+ javascriptLanguage.data.of({
86
+ autocomplete: createCustomCompletions()
87
+ })
88
+ ] : json();
65
89
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classNames("", wrapperClassName), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
66
90
  ReactCodeMirror,
67
91
  {
68
92
  value: code,
69
93
  height: "450px",
70
94
  extensions: [
71
- langExtension,
72
- lintGutter(),
73
- linter(languageMode === "json" ? createJSONLinter() : createJSLinter())
95
+ ...Array.isArray(langExtension) ? langExtension : [langExtension],
96
+ ...showLintGutter ? [lintGutter()] : [],
97
+ linter(languageMode === "json" ? createJSONLinter() : createJSLinter()),
98
+ ...placeholderText && !code ? [placeholder(placeholderText)] : []
74
99
  ],
75
100
  theme: abcdefInit({
76
101
  settings: {
@@ -1 +1 @@
1
- {"version":3,"file":"code-editor.es.js","sources":["../../../src/components/code-editor/code-editor.tsx"],"sourcesContent":["import { javascript } from '@codemirror/lang-javascript';\nimport { json } from '@codemirror/lang-json';\nimport { Diagnostic, linter, lintGutter, LintSource } from '@codemirror/lint';\nimport { tags as t } from '@lezer/highlight';\nimport { abcdefInit } from '@uiw/codemirror-theme-abcdef';\n// import { atomoneInit } from '@uiw/codemirror-theme-atomone';\nimport CodeMirror from '@uiw/react-codemirror';\nimport * as acorn from 'acorn';\nimport classNames from 'classnames';\n\nexport interface CodeEditorProps {\n languageMode: 'javascript' | 'json';\n code: string;\n onChange: (v: string) => void;\n wrapperClassName?: string;\n}\n\nexport const CodeEditor = (props: CodeEditorProps) => {\n const { languageMode, code, onChange, wrapperClassName } = props;\n\n const handleOnChange = (value: string) => {\n // console.log('%c 🐱 cat ==== on change:', 'color: orange; font-size: 16px;', value);\n onChange?.(value);\n };\n\n // 自定义JavaScript语法检查器\n const createJSLinter: () => LintSource = () => {\n return (view: any) => {\n const diagnostics: Diagnostic[] = [];\n const code = view.state.doc.toString() as string;\n console.log('%c 🐱 cat ==== createJSLinter:', 'color: orange; font-size: 16px;', code);\n try {\n acorn.parse(code, { ecmaVersion: 2020 });\n } catch (error: any) {\n const { loc, message } = error;\n console.log('%c ❤️ love ==== js lint error:', 'color: red; font-size: 16px;', { error });\n console.dir(error);\n const errorMsg = `语法错误:第 ${loc.line} 行,第 ${loc.column} - ${message}`;\n diagnostics.push({\n from: loc.line,\n to: loc.line + 1,\n severity: 'error',\n message: errorMsg,\n });\n }\n\n return diagnostics;\n };\n };\n\n // 自定义JSON语法检查器\n const createJSONLinter: () => LintSource = () => {\n const fn: LintSource = (view: any) => {\n console.log('%c 🐱 cat ==== json lint:', 'color: orange; font-size: 16px;', view);\n const diagnostics: Diagnostic[] = [];\n const code = view.state.doc.toString();\n\n try {\n JSON.parse(code);\n } catch (error: any) {\n console.log('%c ❤️ love ==== json lint error:', 'color: red; font-size: 16px;', error);\n const match = error.message.match(/position (\\d+)/);\n if (match) {\n const pos = parseInt(match[1]);\n const line = view.state.doc.lineAt(pos);\n const from = line.from;\n const to = line.to;\n\n diagnostics.push({\n from,\n to,\n severity: 'error',\n message: `JSON解析错误: ${error.message.replace('JSON.parse: ', '')}`,\n });\n }\n }\n\n return diagnostics;\n };\n return fn;\n };\n\n const langExtension = languageMode === 'javascript' ? javascript() : json();\n\n return (\n <div className={classNames('', wrapperClassName)}>\n <CodeMirror\n value={code}\n height='450px'\n extensions={[\n langExtension,\n lintGutter(),\n linter(languageMode === 'json' ? createJSONLinter() : createJSLinter()),\n ]}\n theme={abcdefInit({\n settings: {\n caret: '#c6c6c6',\n fontFamily: 'monospace',\n },\n styles: [{ tag: t.comment, color: '#6272a4' }],\n })}\n onChange={handleOnChange}\n basicSetup={{\n lineNumbers: true,\n highlightActiveLineGutter: true,\n highlightActiveLine: true,\n bracketMatching: true,\n closeBrackets: true,\n foldGutter: true,\n tabSize: 2,\n indentOnInput: true,\n syntaxHighlighting: true,\n autocompletion: true,\n }}\n />\n </div>\n );\n};\n"],"names":["code","acorn.parse","jsx","CodeMirror","t"],"mappings":";;;;;;;;;AAiBa,MAAA,aAAa,CAAC,UAA2B;AACpD,QAAM,EAAE,cAAc,MAAM,UAAU,iBAAqB,IAAA;AAErD,QAAA,iBAAiB,CAAC,UAAkB;AAExC,yCAAW;AAAA,EACb;AAGA,QAAM,iBAAmC,MAAM;AAC7C,WAAO,CAAC,SAAc;AACpB,YAAM,cAA4B,CAAC;AACnC,YAAMA,QAAO,KAAK,MAAM,IAAI,SAAS;AAC7B,cAAA,IAAI,oCAAoC,mCAAmCA,KAAI;AACnF,UAAA;AACFC,cAAYD,OAAM,EAAE,aAAa,MAAM;AAAA,eAChC,OAAY;AACb,cAAA,EAAE,KAAK,QAAA,IAAY;AACzB,gBAAQ,IAAI,mCAAmC,gCAAgC,EAAE,OAAO;AACxF,gBAAQ,IAAI,KAAK;AACX,cAAA,WAAW,UAAU,IAAI,IAAI,QAAQ,IAAI,MAAM,QAAQ,OAAO;AACpE,oBAAY,KAAK;AAAA,UACf,MAAM,IAAI;AAAA,UACV,IAAI,IAAI,OAAO;AAAA,UACf,UAAU;AAAA,UACV,SAAS;AAAA,QAAA,CACV;AAAA,MAAA;AAGI,aAAA;AAAA,IACT;AAAA,EACF;AAGA,QAAM,mBAAqC,MAAM;AACzC,UAAA,KAAiB,CAAC,SAAc;AAC5B,cAAA,IAAI,+BAA+B,mCAAmC,IAAI;AAClF,YAAM,cAA4B,CAAC;AACnC,YAAMA,QAAO,KAAK,MAAM,IAAI,SAAS;AAEjC,UAAA;AACF,aAAK,MAAMA,KAAI;AAAA,eACR,OAAY;AACX,gBAAA,IAAI,qCAA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editor.tsx"],"sourcesContent":["import { CompletionContext, CompletionResult } from '@codemirror/autocomplete';\nimport { javascript, javascriptLanguage } from '@codemirror/lang-javascript';\nimport { json } from '@codemirror/lang-json';\nimport { Diagnostic, linter, lintGutter, LintSource } from '@codemirror/lint';\nimport { placeholder } from '@codemirror/view';\nimport { tags as t } from '@lezer/highlight';\nimport { abcdefInit } from '@uiw/codemirror-theme-abcdef';\nimport CodeMirror, { EditorView } from '@uiw/react-codemirror';\nimport classNames from 'classnames';\nimport { GLOBAL_OBJECT_COMPLETIONS } from './constants';\nimport { lintJavaScriptCode } from './utils';\n\nexport interface CodeEditorProps {\n languageMode: 'javascript' | 'json';\n code: string;\n onChange: (v: string) => void;\n wrapperClassName?: string;\n environment?: 'browser' | 'node'; // 运行环境选择\n placeholder?: string; // placeholder 文本\n showLintGutter?: boolean; // 是否显示左侧错误图标,默认为 true\n}\n\nexport const CodeEditor = (props: CodeEditorProps) => {\n const {\n languageMode,\n code,\n onChange,\n wrapperClassName,\n environment = 'browser',\n placeholder: placeholderText,\n showLintGutter = false,\n } = props;\n\n const handleOnChange = (value: string) => {\n onChange?.(value);\n };\n\n // 创建自定义补全源,用于全局对象方法补全\n const createCustomCompletions = () => {\n return (context: CompletionContext): CompletionResult | null => {\n const word = context.matchBefore(/\\w*/);\n if (!word) return null;\n\n const line = context.state.doc.lineAt(context.pos);\n const lineText = line.text;\n const beforeCursor = lineText.slice(0, context.pos - line.from);\n\n // 检测是否在输入对象的属性(如 console.)\n const memberMatch = beforeCursor.match(/(\\w+)\\.$/);\n if (memberMatch) {\n const objectName = memberMatch[1];\n\n // 使用常量中定义的全局对象方法补全\n if (GLOBAL_OBJECT_COMPLETIONS[objectName]) {\n return {\n from: context.pos,\n options: GLOBAL_OBJECT_COMPLETIONS[objectName].map((method) => ({\n label: method,\n type: 'method',\n info: `${objectName}.${method}()`,\n apply: method,\n })),\n };\n }\n }\n\n return null;\n };\n };\n\n // 自定义JavaScript语法检查器\n const createJSLinter: () => LintSource = () => {\n return (view: EditorView) => {\n const code = view.state.doc.toString() as string;\n return lintJavaScriptCode(code, environment, view);\n };\n };\n\n // 自定义JSON语法检查器\n const createJSONLinter: () => LintSource = () => {\n const fn: LintSource = (view: any) => {\n console.log('%c 🐱 cat ==== json lint:', 'color: orange; font-size: 16px;', view);\n const diagnostics: Diagnostic[] = [];\n const code = view.state.doc.toString();\n\n try {\n JSON.parse(code);\n } catch (error: any) {\n console.log('%c ❤️ love ==== json lint error:', 'color: red; font-size: 16px;', error);\n const match = error.message.match(/position (\\d+)/);\n if (match) {\n const pos = parseInt(match[1]);\n const line = view.state.doc.lineAt(pos);\n const from = line.from;\n const to = line.to;\n\n diagnostics.push({\n from,\n to,\n severity: 'error',\n message: `JSON解析错误: ${error.message.replace('JSON.parse: ', '')}`,\n });\n }\n }\n return diagnostics;\n };\n return fn;\n };\n\n // 为JavaScript语言添加自定义补全源\n const langExtension =\n languageMode === 'javascript'\n ? [\n javascript(),\n javascriptLanguage.data.of({\n autocomplete: createCustomCompletions(),\n }),\n ]\n : json();\n\n return (\n <div className={classNames('', wrapperClassName)}>\n <CodeMirror\n value={code}\n height='450px'\n extensions={[\n ...(Array.isArray(langExtension) ? langExtension : [langExtension]),\n ...(showLintGutter ? [lintGutter()] : []),\n linter(languageMode === 'json' ? createJSONLinter() : createJSLinter()),\n ...(placeholderText && !code ? [placeholder(placeholderText)] : []),\n ]}\n theme={abcdefInit({\n settings: {\n caret: '#c6c6c6',\n fontFamily: 'monospace',\n },\n styles: [{ tag: t.comment, color: '#6272a4' }],\n })}\n onChange={handleOnChange}\n basicSetup={{\n lineNumbers: true,\n highlightActiveLineGutter: true,\n highlightActiveLine: true,\n bracketMatching: true,\n closeBrackets: true,\n foldGutter: true,\n tabSize: 2,\n indentOnInput: true,\n syntaxHighlighting: true,\n autocompletion: true,\n }}\n />\n </div>\n );\n};\n"],"names":["code","jsx","CodeMirror","t"],"mappings":";;;;;;;;;;;AAsBa,MAAA,aAAa,CAAC,UAA2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ACb,2BAA2B;AAAA,QAC3B,qBAAqB;AAAA,QACrB,iBAAiB;AAAA,QACjB,eAAe;AAAA,QACf,YAAY;AAAA,QACZ,SAAS;AAAA,QACT,eAAe;AAAA,QACf,oBAAoB;AAAA,QACpB,gBAAgB;AAAA,MAAA;AAAA,IAClB;AAAA,EAAA,GAEJ;AAEJ;"}
@@ -0,0 +1,135 @@
1
+ export declare const browserGlobals: {
2
+ console: {
3
+ assert: boolean;
4
+ clear: boolean;
5
+ count: boolean;
6
+ countReset: boolean;
7
+ debug: boolean;
8
+ dir: boolean;
9
+ dirxml: boolean;
10
+ error: boolean;
11
+ group: boolean;
12
+ groupCollapsed: boolean;
13
+ groupEnd: boolean;
14
+ info: boolean;
15
+ log: boolean;
16
+ table: boolean;
17
+ time: boolean;
18
+ timeEnd: boolean;
19
+ timeLog: boolean;
20
+ timeStamp: boolean;
21
+ trace: boolean;
22
+ warn: boolean;
23
+ };
24
+ Math: {
25
+ abs: boolean;
26
+ acos: boolean;
27
+ asin: boolean;
28
+ atan: boolean;
29
+ ceil: boolean;
30
+ cos: boolean;
31
+ exp: boolean;
32
+ floor: boolean;
33
+ log: boolean;
34
+ max: boolean;
35
+ min: boolean;
36
+ pow: boolean;
37
+ random: boolean;
38
+ round: boolean;
39
+ sin: boolean;
40
+ sqrt: boolean;
41
+ tan: boolean;
42
+ PI: boolean;
43
+ };
44
+ JSON: {
45
+ parse: boolean;
46
+ stringify: boolean;
47
+ };
48
+ };
49
+ export declare const nodeGlobals: {
50
+ process: {
51
+ env: boolean;
52
+ argv: boolean;
53
+ exit: boolean;
54
+ cwd: boolean;
55
+ };
56
+ Buffer: {
57
+ alloc: boolean;
58
+ from: boolean;
59
+ isBuffer: boolean;
60
+ };
61
+ require: boolean;
62
+ module: {
63
+ exports: boolean;
64
+ };
65
+ exports: boolean;
66
+ __dirname: boolean;
67
+ __filename: boolean;
68
+ console: {
69
+ assert: boolean;
70
+ clear: boolean;
71
+ count: boolean;
72
+ countReset: boolean;
73
+ debug: boolean;
74
+ dir: boolean;
75
+ dirxml: boolean;
76
+ error: boolean;
77
+ group: boolean;
78
+ groupCollapsed: boolean;
79
+ groupEnd: boolean;
80
+ info: boolean;
81
+ log: boolean;
82
+ table: boolean;
83
+ time: boolean;
84
+ timeEnd: boolean;
85
+ timeLog: boolean;
86
+ timeStamp: boolean;
87
+ trace: boolean;
88
+ warn: boolean;
89
+ };
90
+ Math: {
91
+ abs: boolean;
92
+ acos: boolean;
93
+ asin: boolean;
94
+ atan: boolean;
95
+ ceil: boolean;
96
+ cos: boolean;
97
+ exp: boolean;
98
+ floor: boolean;
99
+ log: boolean;
100
+ max: boolean;
101
+ min: boolean;
102
+ pow: boolean;
103
+ random: boolean;
104
+ round: boolean;
105
+ sin: boolean;
106
+ sqrt: boolean;
107
+ tan: boolean;
108
+ PI: boolean;
109
+ };
110
+ JSON: {
111
+ parse: boolean;
112
+ stringify: boolean;
113
+ };
114
+ };
115
+ export declare const GLOBAL_OBJECT_COMPLETIONS: {
116
+ [key: string]: string[];
117
+ };
118
+ export declare const JAVASCRIPT_KEYWORDS: string[];
119
+ export declare const GLOBAL_OBJECT_NAMES: RegExp;
120
+ export declare const ERROR_MESSAGES: {
121
+ METHOD_NOT_EXIST: (objectName: string, propertyName: string) => string;
122
+ UNUSED_VARIABLE: (varName: string) => string;
123
+ SYNTAX_ERROR: (line: number, column: number, message: string) => string;
124
+ };
125
+ export declare const LINT_CONFIG: {
126
+ ECMA_VERSION: 2020;
127
+ CONSOLE_STYLES: {
128
+ ERROR: string;
129
+ };
130
+ };
131
+ export declare const DIAGNOSTIC_SEVERITY: {
132
+ ERROR: "error";
133
+ WARNING: "warning";
134
+ INFO: "info";
135
+ };
@@ -0,0 +1,281 @@
1
+ const browserGlobals = {
2
+ console: {
3
+ assert: true,
4
+ clear: true,
5
+ count: true,
6
+ countReset: true,
7
+ debug: true,
8
+ dir: true,
9
+ dirxml: true,
10
+ error: true,
11
+ group: true,
12
+ groupCollapsed: true,
13
+ groupEnd: true,
14
+ info: true,
15
+ log: true,
16
+ table: true,
17
+ time: true,
18
+ timeEnd: true,
19
+ timeLog: true,
20
+ timeStamp: true,
21
+ trace: true,
22
+ warn: true
23
+ },
24
+ Math: {
25
+ abs: true,
26
+ acos: true,
27
+ asin: true,
28
+ atan: true,
29
+ ceil: true,
30
+ cos: true,
31
+ exp: true,
32
+ floor: true,
33
+ log: true,
34
+ max: true,
35
+ min: true,
36
+ pow: true,
37
+ random: true,
38
+ round: true,
39
+ sin: true,
40
+ sqrt: true,
41
+ tan: true,
42
+ PI: true
43
+ },
44
+ JSON: { parse: true, stringify: true }
45
+ };
46
+ const nodeGlobals = {
47
+ ...browserGlobals,
48
+ process: { env: true, argv: true, exit: true, cwd: true },
49
+ Buffer: { alloc: true, from: true, isBuffer: true },
50
+ require: true,
51
+ module: { exports: true },
52
+ exports: true,
53
+ __dirname: true,
54
+ __filename: true
55
+ };
56
+ const GLOBAL_OBJECT_COMPLETIONS = {
57
+ console: [
58
+ "log",
59
+ "error",
60
+ "warn",
61
+ "info",
62
+ "debug",
63
+ "trace",
64
+ "assert",
65
+ "clear",
66
+ "count",
67
+ "countReset",
68
+ "dir",
69
+ "dirxml",
70
+ "group",
71
+ "groupCollapsed",
72
+ "groupEnd",
73
+ "table",
74
+ "time",
75
+ "timeEnd",
76
+ "timeLog",
77
+ "profile",
78
+ "profileEnd"
79
+ ],
80
+ Math: [
81
+ "abs",
82
+ "acos",
83
+ "acosh",
84
+ "asin",
85
+ "asinh",
86
+ "atan",
87
+ "atan2",
88
+ "atanh",
89
+ "cbrt",
90
+ "ceil",
91
+ "clz32",
92
+ "cos",
93
+ "cosh",
94
+ "exp",
95
+ "expm1",
96
+ "floor",
97
+ "fround",
98
+ "hypot",
99
+ "imul",
100
+ "log",
101
+ "log10",
102
+ "log1p",
103
+ "log2",
104
+ "max",
105
+ "min",
106
+ "pow",
107
+ "random",
108
+ "round",
109
+ "sign",
110
+ "sin",
111
+ "sinh",
112
+ "sqrt",
113
+ "tan",
114
+ "tanh",
115
+ "trunc",
116
+ "E",
117
+ "LN10",
118
+ "LN2",
119
+ "LOG10E",
120
+ "LOG2E",
121
+ "PI",
122
+ "SQRT1_2",
123
+ "SQRT2"
124
+ ],
125
+ JSON: ["parse", "stringify"],
126
+ Object: [
127
+ "assign",
128
+ "create",
129
+ "defineProperty",
130
+ "defineProperties",
131
+ "entries",
132
+ "freeze",
133
+ "fromEntries",
134
+ "getOwnPropertyDescriptor",
135
+ "getOwnPropertyDescriptors",
136
+ "getOwnPropertyNames",
137
+ "getOwnPropertySymbols",
138
+ "getPrototypeOf",
139
+ "hasOwnProperty",
140
+ "is",
141
+ "isExtensible",
142
+ "isFrozen",
143
+ "isSealed",
144
+ "keys",
145
+ "preventExtensions",
146
+ "seal",
147
+ "setPrototypeOf",
148
+ "values"
149
+ ],
150
+ Array: [
151
+ "from",
152
+ "isArray",
153
+ "of",
154
+ "concat",
155
+ "copyWithin",
156
+ "entries",
157
+ "every",
158
+ "fill",
159
+ "filter",
160
+ "find",
161
+ "findIndex",
162
+ "flat",
163
+ "flatMap",
164
+ "forEach",
165
+ "includes",
166
+ "indexOf",
167
+ "join",
168
+ "keys",
169
+ "lastIndexOf",
170
+ "map",
171
+ "pop",
172
+ "push",
173
+ "reduce",
174
+ "reduceRight",
175
+ "reverse",
176
+ "shift",
177
+ "slice",
178
+ "some",
179
+ "sort",
180
+ "splice",
181
+ "toString",
182
+ "unshift",
183
+ "values"
184
+ ],
185
+ String: [
186
+ "charAt",
187
+ "charCodeAt",
188
+ "codePointAt",
189
+ "concat",
190
+ "endsWith",
191
+ "includes",
192
+ "indexOf",
193
+ "lastIndexOf",
194
+ "localeCompare",
195
+ "match",
196
+ "normalize",
197
+ "padEnd",
198
+ "padStart",
199
+ "repeat",
200
+ "replace",
201
+ "search",
202
+ "slice",
203
+ "split",
204
+ "startsWith",
205
+ "substr",
206
+ "substring",
207
+ "toLocaleLowerCase",
208
+ "toLocaleUpperCase",
209
+ "toLowerCase",
210
+ "toString",
211
+ "toUpperCase",
212
+ "trim",
213
+ "trimEnd",
214
+ "trimStart",
215
+ "valueOf"
216
+ ],
217
+ Date: [
218
+ "getDate",
219
+ "getDay",
220
+ "getFullYear",
221
+ "getHours",
222
+ "getMilliseconds",
223
+ "getMinutes",
224
+ "getMonth",
225
+ "getSeconds",
226
+ "getTime",
227
+ "getTimezoneOffset",
228
+ "getUTCDate",
229
+ "getUTCDay",
230
+ "getUTCFullYear",
231
+ "getUTCHours",
232
+ "getUTCMilliseconds",
233
+ "getUTCMinutes",
234
+ "getUTCMonth",
235
+ "getUTCSeconds",
236
+ "now",
237
+ "parse",
238
+ "setDate",
239
+ "setFullYear",
240
+ "setHours",
241
+ "setMilliseconds",
242
+ "setMinutes",
243
+ "setMonth",
244
+ "setSeconds",
245
+ "setTime",
246
+ "toDateString",
247
+ "toISOString",
248
+ "toJSON",
249
+ "toLocaleDateString",
250
+ "toLocaleString",
251
+ "toLocaleTimeString",
252
+ "toString",
253
+ "toTimeString",
254
+ "toUTCString",
255
+ "valueOf"
256
+ ]
257
+ };
258
+ const ERROR_MESSAGES = {
259
+ METHOD_NOT_EXIST: (objectName, propertyName) => `${objectName}.${propertyName} 方法不存在`,
260
+ UNUSED_VARIABLE: (varName) => `未使用的变量: ${varName}`,
261
+ SYNTAX_ERROR: (line, column, message) => `语法错误:第 ${line} 行,第 ${column} 列 - ${message}`
262
+ };
263
+ const LINT_CONFIG = {
264
+ ECMA_VERSION: 2020,
265
+ CONSOLE_STYLES: {
266
+ ERROR: "color: red; font-size: 16px;"
267
+ }
268
+ };
269
+ const DIAGNOSTIC_SEVERITY = {
270
+ ERROR: "error",
271
+ WARNING: "warning"
272
+ };
273
+ export {
274
+ DIAGNOSTIC_SEVERITY,
275
+ ERROR_MESSAGES,
276
+ GLOBAL_OBJECT_COMPLETIONS,
277
+ LINT_CONFIG,
278
+ browserGlobals,
279
+ nodeGlobals
280
+ };
281
+ //# sourceMappingURL=constants.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.es.js","sources":["../../../src/components/code-editor/constants.ts"],"sourcesContent":["export // 浏览器环境全局变量\nconst browserGlobals = {\n console: {\n assert: true,\n clear: true,\n count: true,\n countReset: true,\n debug: true,\n dir: true,\n dirxml: true,\n error: true,\n group: true,\n groupCollapsed: true,\n groupEnd: true,\n info: true,\n log: true,\n table: true,\n time: true,\n timeEnd: true,\n timeLog: true,\n timeStamp: true,\n trace: true,\n warn: true,\n },\n Math: {\n abs: true,\n acos: true,\n asin: true,\n atan: true,\n ceil: true,\n cos: true,\n exp: true,\n floor: true,\n log: true,\n max: true,\n min: true,\n pow: true,\n random: true,\n round: true,\n sin: true,\n sqrt: true,\n tan: true,\n PI: true,\n },\n JSON: { parse: true, stringify: true },\n};\n\n// Node.js 环境全局变量 (基于 global.d.ts 类型定义)\nexport const nodeGlobals = {\n ...browserGlobals,\n process: { env: true, argv: true, exit: true, cwd: true },\n Buffer: { alloc: true, from: true, isBuffer: true },\n require: true,\n module: { exports: true },\n exports: true,\n __dirname: true,\n __filename: true,\n};\n\n// 自动补全相关常量定义\n\n// 全局对象方法补全映射\nexport const GLOBAL_OBJECT_COMPLETIONS: { [key: string]: string[] } = {\n console: [\n 'log',\n 'error',\n 'warn',\n 'info',\n 'debug',\n 'trace',\n 'assert',\n 'clear',\n 'count',\n 'countReset',\n 'dir',\n 'dirxml',\n 'group',\n 'groupCollapsed',\n 'groupEnd',\n 'table',\n 'time',\n 'timeEnd',\n 'timeLog',\n 'profile',\n 'profileEnd',\n ],\n Math: [\n 'abs',\n 'acos',\n 'acosh',\n 'asin',\n 'asinh',\n 'atan',\n 'atan2',\n 'atanh',\n 'cbrt',\n 'ceil',\n 'clz32',\n 'cos',\n 'cosh',\n 'exp',\n 'expm1',\n 'floor',\n 'fround',\n 'hypot',\n 'imul',\n 'log',\n 'log10',\n 'log1p',\n 'log2',\n 'max',\n 'min',\n 'pow',\n 'random',\n 'round',\n 'sign',\n 'sin',\n 'sinh',\n 'sqrt',\n 'tan',\n 'tanh',\n 'trunc',\n 'E',\n 'LN10',\n 'LN2',\n 'LOG10E',\n 'LOG2E',\n 'PI',\n 'SQRT1_2',\n 'SQRT2',\n ],\n JSON: ['parse', 'stringify'],\n Object: [\n 'assign',\n 'create',\n 'defineProperty',\n 'defineProperties',\n 'entries',\n 'freeze',\n 'fromEntries',\n 'getOwnPropertyDescriptor',\n 'getOwnPropertyDescriptors',\n 'getOwnPropertyNames',\n 'getOwnPropertySymbols',\n 'getPrototypeOf',\n 'hasOwnProperty',\n 'is',\n 'isExtensible',\n 'isFrozen',\n 'isSealed',\n 'keys',\n 'preventExtensions',\n 'seal',\n 'setPrototypeOf',\n 'values',\n ],\n Array: [\n 'from',\n 'isArray',\n 'of',\n 'concat',\n 'copyWithin',\n 'entries',\n 'every',\n 'fill',\n 'filter',\n 'find',\n 'findIndex',\n 'flat',\n 'flatMap',\n 'forEach',\n 'includes',\n 'indexOf',\n 'join',\n 'keys',\n 'lastIndexOf',\n 'map',\n 'pop',\n 'push',\n 'reduce',\n 'reduceRight',\n 'reverse',\n 'shift',\n 'slice',\n 'some',\n 'sort',\n 'splice',\n 'toString',\n 'unshift',\n 'values',\n ],\n String: [\n 'charAt',\n 'charCodeAt',\n 'codePointAt',\n 'concat',\n 'endsWith',\n 'includes',\n 'indexOf',\n 'lastIndexOf',\n 'localeCompare',\n 'match',\n 'normalize',\n 'padEnd',\n 'padStart',\n 'repeat',\n 'replace',\n 'search',\n 'slice',\n 'split',\n 'startsWith',\n 'substr',\n 'substring',\n 'toLocaleLowerCase',\n 'toLocaleUpperCase',\n 'toLowerCase',\n 'toString',\n 'toUpperCase',\n 'trim',\n 'trimEnd',\n 'trimStart',\n 'valueOf',\n ],\n Date: [\n 'getDate',\n 'getDay',\n 'getFullYear',\n 'getHours',\n 'getMilliseconds',\n 'getMinutes',\n 'getMonth',\n 'getSeconds',\n 'getTime',\n 'getTimezoneOffset',\n 'getUTCDate',\n 'getUTCDay',\n 'getUTCFullYear',\n 'getUTCHours',\n 'getUTCMilliseconds',\n 'getUTCMinutes',\n 'getUTCMonth',\n 'getUTCSeconds',\n 'now',\n 'parse',\n 'setDate',\n 'setFullYear',\n 'setHours',\n 'setMilliseconds',\n 'setMinutes',\n 'setMonth',\n 'setSeconds',\n 'setTime',\n 'toDateString',\n 'toISOString',\n 'toJSON',\n 'toLocaleDateString',\n 'toLocaleString',\n 'toLocaleTimeString',\n 'toString',\n 'toTimeString',\n 'toUTCString',\n 'valueOf',\n ],\n};\n\n// JavaScript 关键字和全局对象名称\nexport const JAVASCRIPT_KEYWORDS = [\n 'function',\n 'var',\n 'let',\n 'const',\n 'if',\n 'else',\n 'for',\n 'while',\n 'do',\n 'switch',\n 'case',\n 'default',\n 'break',\n 'continue',\n 'return',\n 'try',\n 'catch',\n 'finally',\n 'throw',\n 'new',\n 'this',\n 'typeof',\n 'instanceof',\n 'in',\n 'delete',\n 'void',\n 'null',\n 'undefined',\n 'true',\n 'false',\n 'console',\n 'Math',\n 'JSON',\n 'Object',\n 'Array',\n 'String',\n 'Number',\n 'Date',\n 'RegExp',\n 'Error',\n];\n\n// 全局对象名称(用于类型判断)\nexport const GLOBAL_OBJECT_NAMES =\n /^(console|Math|JSON|Object|Array|String|Number|Date|RegExp|Error)$/;\n\n// 错误消息模板\nexport const ERROR_MESSAGES = {\n METHOD_NOT_EXIST: (objectName: string, propertyName: string) =>\n `${objectName}.${propertyName} 方法不存在`,\n UNUSED_VARIABLE: (varName: string) => `未使用的变量: ${varName}`,\n SYNTAX_ERROR: (line: number, column: number, message: string) =>\n `语法错误:第 ${line} 行,第 ${column} 列 - ${message}`,\n};\n\n// 语法检查配置\nexport const LINT_CONFIG = {\n ECMA_VERSION: 2020 as const,\n CONSOLE_STYLES: {\n ERROR: 'color: red; font-size: 16px;',\n },\n};\n\n// 诊断严重级别\nexport const DIAGNOSTIC_SEVERITY = {\n ERROR: 'error' as const,\n WARNING: 'warning' as const,\n INFO: 'info' as const,\n};\n"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AA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,MAAM,CAAC,SAAS,WAAW;AAAA,EAC3B,QAAQ;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,I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ACP,SAAS;AAEX;"}
@@ -0,0 +1,61 @@
1
+ import { Diagnostic } from '@codemirror/lint';
2
+ import { EditorView } from '@codemirror/view';
3
+
4
+ export declare const getGlobalDefinitions: (environment: "browser" | "node") => {
5
+ console: {
6
+ assert: boolean;
7
+ clear: boolean;
8
+ count: boolean;
9
+ countReset: boolean;
10
+ debug: boolean;
11
+ dir: boolean;
12
+ dirxml: boolean;
13
+ error: boolean;
14
+ group: boolean;
15
+ groupCollapsed: boolean;
16
+ groupEnd: boolean;
17
+ info: boolean;
18
+ log: boolean;
19
+ table: boolean;
20
+ time: boolean;
21
+ timeEnd: boolean;
22
+ timeLog: boolean;
23
+ timeStamp: boolean;
24
+ trace: boolean;
25
+ warn: boolean;
26
+ };
27
+ Math: {
28
+ abs: boolean;
29
+ acos: boolean;
30
+ asin: boolean;
31
+ atan: boolean;
32
+ ceil: boolean;
33
+ cos: boolean;
34
+ exp: boolean;
35
+ floor: boolean;
36
+ log: boolean;
37
+ max: boolean;
38
+ min: boolean;
39
+ pow: boolean;
40
+ random: boolean;
41
+ round: boolean;
42
+ sin: boolean;
43
+ sqrt: boolean;
44
+ tan: boolean;
45
+ PI: boolean;
46
+ };
47
+ JSON: {
48
+ parse: boolean;
49
+ stringify: boolean;
50
+ };
51
+ };
52
+ export interface VariableInfo {
53
+ line: number;
54
+ column: number;
55
+ used: boolean;
56
+ }
57
+ export declare const collectVariableDeclarations: (ast: any) => Map<string, VariableInfo>;
58
+ export declare const checkVariableUsageAndMethods: (ast: any, declaredVars: Map<string, VariableInfo>, globals: any, view: EditorView) => Diagnostic[];
59
+ export declare const checkUnusedVariables: (declaredVars: Map<string, VariableInfo>, view: EditorView) => Diagnostic[];
60
+ export declare const handleSyntaxError: (error: any, view: EditorView) => Diagnostic[];
61
+ export declare const lintJavaScriptCode: (code: string, environment: "browser" | "node", view: EditorView) => Diagnostic[];