zcw-shared 1.32.0 → 1.32.2

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.
Files changed (143) hide show
  1. package/README.md +2 -2
  2. package/dist/functions/platform/tencent-cloud/deploy.tcb.d.ts +13 -0
  3. package/dist/functions/platform/tencent-cloud/deploy.tcb.js +46 -0
  4. package/dist/functions/platform/tencent-cloud/deploy.tcb.js.map +1 -0
  5. package/dist/functions/platform/tencent-cloud/getSecret.d.ts +4 -0
  6. package/dist/functions/platform/tencent-cloud/getSecret.js +19 -0
  7. package/dist/functions/platform/tencent-cloud/getSecret.js.map +1 -0
  8. package/dist/functions/platform/uniapp/app-plus/buildAndroidApp.d.ts +27 -0
  9. package/dist/functions/platform/uniapp/app-plus/buildAndroidApp.js +287 -0
  10. package/dist/functions/platform/uniapp/app-plus/buildAndroidApp.js.map +1 -0
  11. package/dist/functions/platform/uniapp/build.d.ts +21 -0
  12. package/dist/functions/platform/uniapp/build.js +83 -0
  13. package/dist/functions/platform/uniapp/build.js.map +1 -0
  14. package/dist/functions/platform/uniapp/detectAndroidProjectStructure.d.ts +11 -0
  15. package/dist/functions/platform/uniapp/detectAndroidProjectStructure.js +30 -0
  16. package/dist/functions/platform/uniapp/detectAndroidProjectStructure.js.map +1 -0
  17. package/dist/functions/platform/uniapp/detectProjectType.d.ts +20 -0
  18. package/dist/functions/platform/uniapp/detectProjectType.js +68 -0
  19. package/dist/functions/platform/uniapp/detectProjectType.js.map +1 -0
  20. package/dist/functions/platform/uniapp/parseManifest.d.ts +18 -0
  21. package/dist/functions/platform/uniapp/parseManifest.js +49 -0
  22. package/dist/functions/platform/uniapp/parseManifest.js.map +1 -0
  23. package/dist/functions/platform/uniapp/waitForPages.d.ts +7 -0
  24. package/dist/functions/platform/uniapp/waitForPages.js +20 -0
  25. package/dist/functions/platform/uniapp/waitForPages.js.map +1 -0
  26. package/dist/functions/string/visualizeRegexSteps.d.ts +39 -0
  27. package/dist/functions/string/visualizeRegexSteps.js +446 -0
  28. package/dist/functions/string/visualizeRegexSteps.js.map +1 -0
  29. package/dist/functions/utils/createI18n.d.ts +2 -0
  30. package/dist/functions/utils/createI18n.js +97 -0
  31. package/dist/functions/utils/createI18n.js.map +1 -0
  32. package/dist/functions/utils/formatString.d.ts +5 -0
  33. package/dist/functions/utils/formatString.js +9 -0
  34. package/dist/functions/utils/formatString.js.map +1 -0
  35. package/dist/hooks/usePermission.d.ts +7 -0
  36. package/dist/hooks/usePermission.js +123 -0
  37. package/dist/hooks/usePermission.js.map +1 -0
  38. package/dist/vue-hooks/dom/useKeyboard.d.ts +29 -0
  39. package/dist/vue-hooks/dom/useKeyboard.js +129 -0
  40. package/dist/vue-hooks/dom/useKeyboard.js.map +1 -0
  41. package/dist/vue-hooks/state/useFileUpload.d.ts +23 -0
  42. package/dist/vue-hooks/state/useFileUpload.js +93 -0
  43. package/dist/vue-hooks/state/useFileUpload.js.map +1 -0
  44. package/package.json +2 -5
  45. package/dist/functions/algorithm/lcsVisual.d.ts +0 -6
  46. package/dist/functions/algorithm/lcsVisual.js +0 -88
  47. package/dist/functions/algorithm/lcsVisual.js.map +0 -1
  48. package/dist/functions/algorithm/mergeSortVisual.d.ts +0 -5
  49. package/dist/functions/algorithm/mergeSortVisual.js +0 -103
  50. package/dist/functions/algorithm/mergeSortVisual.js.map +0 -1
  51. package/dist/functions/algorithm/nQueensVisual.d.ts +0 -14
  52. package/dist/functions/algorithm/nQueensVisual.js +0 -94
  53. package/dist/functions/algorithm/nQueensVisual.js.map +0 -1
  54. package/dist/functions/algorithm/numIslandsVisual.d.ts +0 -17
  55. package/dist/functions/algorithm/numIslandsVisual.js +0 -102
  56. package/dist/functions/algorithm/numIslandsVisual.js.map +0 -1
  57. package/dist/functions/algorithm/quickSortVisual.d.ts +0 -18
  58. package/dist/functions/algorithm/quickSortVisual.js +0 -104
  59. package/dist/functions/algorithm/quickSortVisual.js.map +0 -1
  60. package/dist/functions/browser/detectDevice.d.ts +0 -10
  61. package/dist/functions/browser/detectDevice.js +0 -49
  62. package/dist/functions/browser/detectDevice.js.map +0 -1
  63. package/dist/functions/cookie/getCookie.d.ts +0 -5
  64. package/dist/functions/cookie/getCookie.js +0 -14
  65. package/dist/functions/cookie/getCookie.js.map +0 -1
  66. package/dist/functions/cookie/removeCookie.d.ts +0 -8
  67. package/dist/functions/cookie/removeCookie.js +0 -12
  68. package/dist/functions/cookie/removeCookie.js.map +0 -1
  69. package/dist/functions/cookie/setCookie.d.ts +0 -11
  70. package/dist/functions/cookie/setCookie.js +0 -23
  71. package/dist/functions/cookie/setCookie.js.map +0 -1
  72. package/dist/functions/data-structures/EventEmitter.d.ts +0 -32
  73. package/dist/functions/data-structures/EventEmitter.js +0 -108
  74. package/dist/functions/data-structures/EventEmitter.js.map +0 -1
  75. package/dist/functions/data-structures/MyPromise.d.ts +0 -32
  76. package/dist/functions/data-structures/MyPromise.js +0 -254
  77. package/dist/functions/data-structures/MyPromise.js.map +0 -1
  78. package/dist/functions/reactive/useReactiveCookie.d.ts +0 -19
  79. package/dist/functions/reactive/useReactiveCookie.js +0 -84
  80. package/dist/functions/reactive/useReactiveCookie.js.map +0 -1
  81. package/dist/hooks/useClickOutside.d.ts +0 -12
  82. package/dist/hooks/useClickOutside.js +0 -16
  83. package/dist/hooks/useClickOutside.js.map +0 -1
  84. package/dist/hooks/useClipboard.d.ts +0 -20
  85. package/dist/hooks/useClipboard.js +0 -33
  86. package/dist/hooks/useClipboard.js.map +0 -1
  87. package/dist/hooks/useCounter.d.ts +0 -19
  88. package/dist/hooks/useCounter.js +0 -44
  89. package/dist/hooks/useCounter.js.map +0 -1
  90. package/dist/hooks/useEventListener.d.ts +0 -14
  91. package/dist/hooks/useEventListener.js +0 -18
  92. package/dist/hooks/useEventListener.js.map +0 -1
  93. package/dist/hooks/useInterval.d.ts +0 -19
  94. package/dist/hooks/useInterval.js +0 -33
  95. package/dist/hooks/useInterval.js.map +0 -1
  96. package/dist/hooks/useTimeout.d.ts +0 -20
  97. package/dist/hooks/useTimeout.js +0 -40
  98. package/dist/hooks/useTimeout.js.map +0 -1
  99. package/dist/hooks/useToggle.d.ts +0 -15
  100. package/dist/hooks/useToggle.js +0 -23
  101. package/dist/hooks/useToggle.js.map +0 -1
  102. package/dist/reactive/createGlobalState.d.ts +0 -2
  103. package/dist/reactive/createGlobalState.js +0 -11
  104. package/dist/reactive/createGlobalState.js.map +0 -1
  105. package/dist/reactive/createSharedComposable.d.ts +0 -2
  106. package/dist/reactive/createSharedComposable.js +0 -13
  107. package/dist/reactive/createSharedComposable.js.map +0 -1
  108. package/dist/reactive/errorManager.d.ts +0 -63
  109. package/dist/reactive/errorManager.js +0 -199
  110. package/dist/reactive/errorManager.js.map +0 -1
  111. package/dist/reactive/i18n.d.ts +0 -27
  112. package/dist/reactive/i18n.js +0 -119
  113. package/dist/reactive/i18n.js.map +0 -1
  114. package/dist/reactive/permission.d.ts +0 -40
  115. package/dist/reactive/permission.js +0 -189
  116. package/dist/reactive/permission.js.map +0 -1
  117. package/dist/reactive/pinia.d.ts +0 -52
  118. package/dist/reactive/pinia.js +0 -183
  119. package/dist/reactive/pinia.js.map +0 -1
  120. package/dist/reactive/useAltool.d.ts +0 -39
  121. package/dist/reactive/useAltool.js +0 -350
  122. package/dist/reactive/useAltool.js.map +0 -1
  123. package/dist/reactive/useCache.d.ts +0 -18
  124. package/dist/reactive/useCache.js +0 -82
  125. package/dist/reactive/useCache.js.map +0 -1
  126. package/dist/reactive/useLocalStorage.d.ts +0 -8
  127. package/dist/reactive/useLocalStorage.js +0 -101
  128. package/dist/reactive/useLocalStorage.js.map +0 -1
  129. package/dist/reactive/usePluginSystem.d.ts +0 -11
  130. package/dist/reactive/usePluginSystem.js +0 -34
  131. package/dist/reactive/usePluginSystem.js.map +0 -1
  132. package/dist/reactive/useSessionStorage.d.ts +0 -8
  133. package/dist/reactive/useSessionStorage.js +0 -101
  134. package/dist/reactive/useSessionStorage.js.map +0 -1
  135. package/dist/reactive/useStorage.d.ts +0 -13
  136. package/dist/reactive/useStorage.js +0 -62
  137. package/dist/reactive/useStorage.js.map +0 -1
  138. package/dist/reactive/useStorageWithIndexedDB.d.ts +0 -8
  139. package/dist/reactive/useStorageWithIndexedDB.js +0 -132
  140. package/dist/reactive/useStorageWithIndexedDB.js.map +0 -1
  141. package/dist/vue-hooks/state/useToken.d.ts +0 -36
  142. package/dist/vue-hooks/state/useToken.js +0 -121
  143. package/dist/vue-hooks/state/useToken.js.map +0 -1
@@ -0,0 +1,68 @@
1
+ export var UniAppProjectType;
2
+ (function (UniAppProjectType) {
3
+ UniAppProjectType["HBUILDERX"] = "hbuilderx";
4
+ UniAppProjectType["CLI"] = "cli";
5
+ })(UniAppProjectType || (UniAppProjectType = {}));
6
+ export function isHBuilderXProject(projectPath, deps) {
7
+ const hbuilderxPath = `${projectPath}/.hbuilderx`;
8
+ const uniModulesPath = `${projectPath}/uni_modules`;
9
+ return deps.existsSync(hbuilderxPath) || deps.existsSync(uniModulesPath);
10
+ }
11
+ export function isCLIProject(projectPath, deps) {
12
+ const packagePath = `${projectPath}/package.json`;
13
+ const nodeModulesPath = `${projectPath}/node_modules`;
14
+ const vueConfigPath = `${projectPath}/vue.config.js`;
15
+ const viteConfigPath = `${projectPath}/vite.config.js`;
16
+ const hasPackageJson = deps.existsSync(packagePath);
17
+ const hasNodeModules = deps.existsSync(nodeModulesPath);
18
+ const hasVueConfig = deps.existsSync(vueConfigPath);
19
+ const hasViteConfig = deps.existsSync(viteConfigPath);
20
+ return hasPackageJson && (hasNodeModules || hasVueConfig || hasViteConfig);
21
+ }
22
+ export function detectUniAppProjectType(projectPath, deps) {
23
+ if (isHBuilderXProject(projectPath, deps)) {
24
+ return UniAppProjectType.HBUILDERX;
25
+ }
26
+ if (isCLIProject(projectPath, deps)) {
27
+ return UniAppProjectType.CLI;
28
+ }
29
+ return UniAppProjectType.CLI;
30
+ }
31
+ export function detectProjectType(projectPath, deps) {
32
+ try {
33
+ const manifestSrcPath = deps.join(projectPath, 'src', 'manifest.json');
34
+ const manifestRootPath = deps.join(projectPath, 'manifest.json');
35
+ const hasManifest = deps.existsSync(manifestSrcPath) || deps.existsSync(manifestRootPath);
36
+ if (!hasManifest) {
37
+ return {
38
+ isUniApp: false,
39
+ error: '未找到 manifest.json 文件,不是 UniApp 项目'
40
+ };
41
+ }
42
+ const pagesSrcPath = deps.join(projectPath, 'src', 'pages.json');
43
+ const pagesRootPath = deps.join(projectPath, 'pages.json');
44
+ const hasPages = deps.existsSync(pagesSrcPath) || deps.existsSync(pagesRootPath);
45
+ if (!hasPages) {
46
+ return {
47
+ isUniApp: false,
48
+ error: '未找到 pages.json 文件,不是 UniApp 项目'
49
+ };
50
+ }
51
+ const projectType = detectUniAppProjectType(projectPath, deps);
52
+ const manifestPath = deps.existsSync(manifestSrcPath) ? manifestSrcPath : manifestRootPath;
53
+ const pagesPath = deps.existsSync(pagesSrcPath) ? pagesSrcPath : pagesRootPath;
54
+ return {
55
+ isUniApp: true,
56
+ projectType,
57
+ manifestPath,
58
+ pagesPath
59
+ };
60
+ }
61
+ catch (error) {
62
+ return {
63
+ isUniApp: false,
64
+ error: `检测项目类型时发生错误: ${error instanceof Error ? error.message : String(error)}`
65
+ };
66
+ }
67
+ }
68
+ //# sourceMappingURL=detectProjectType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detectProjectType.js","sourceRoot":"","sources":["../../../../src/functions/platform/uniapp/detectProjectType.ts"],"names":[],"mappings":"AAYA,MAAM,CAAN,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAE3B,4CAAuB,CAAA;IAEvB,gCAAW,CAAA;AACb,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B;AA4BD,MAAM,UAAU,kBAAkB,CAAC,WAAmB,EAAE,IAA2B;IACjF,MAAM,aAAa,GAAG,GAAG,WAAW,aAAa,CAAA;IACjD,MAAM,cAAc,GAAG,GAAG,WAAW,cAAc,CAAA;IACnD,OAAO,IAAI,CAAC,UAA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,KAAK,CAAC,EAAE;SAChF,CAAA;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { FileSystem, Path } from '../../../references/node.d';
2
+ import type { JSON5Parser } from '../../../references/json5.d';
3
+ export interface ParseManifestDeps {
4
+ existsSync: FileSystem['existsSync'];
5
+ readFileSync: FileSystem['readFileSync'];
6
+ join: Path['join'];
7
+ parse: JSON5Parser['parse'];
8
+ }
9
+ export interface UniAppManifest {
10
+ appid: string;
11
+ name: string;
12
+ description?: string;
13
+ }
14
+ export declare function parseManifest(projectPath: string, deps: ParseManifestDeps): {
15
+ success: boolean;
16
+ manifest?: UniAppManifest;
17
+ error?: string;
18
+ };
@@ -0,0 +1,49 @@
1
+ import { detectProjectType } from './detectProjectType';
2
+ export function parseManifest(projectPath, deps) {
3
+ const typeResult = detectProjectType(projectPath, {
4
+ existsSync: deps.existsSync,
5
+ join: deps.join
6
+ });
7
+ if (!typeResult.isUniApp) {
8
+ return { success: false, error: typeResult.error || '不是 UniApp 项目' };
9
+ }
10
+ if (!typeResult.manifestPath) {
11
+ return { success: false, error: '无法确定 manifest.json 路径' };
12
+ }
13
+ let manifest;
14
+ try {
15
+ const manifestContent = deps.readFileSync(typeResult.manifestPath, 'utf8');
16
+ manifest = deps.parse(manifestContent);
17
+ }
18
+ catch (error) {
19
+ return { success: false, error: `解析 manifest.json 失败: ${error instanceof Error ? error.message : String(error)}` };
20
+ }
21
+ if (!manifest.appid) {
22
+ return { success: false, error: '未配置 appid,请在 manifest.json 中配置 appid 字段' };
23
+ }
24
+ if (typeof manifest.appid !== 'string' || manifest.appid.trim() === '') {
25
+ return { success: false, error: 'appid 不能为空,请在 manifest.json 中正确配置' };
26
+ }
27
+ if (!manifest.name) {
28
+ return { success: false, error: '未配置应用名称,请在 manifest.json 中配置 name 字段' };
29
+ }
30
+ if (typeof manifest.name !== 'string' || manifest.name.trim() === '') {
31
+ return { success: false, error: '应用名称不能为空,请在 manifest.json 中正确配置' };
32
+ }
33
+ const uniappIdPattern = /^__UNI__[A-F0-9]+$/;
34
+ if (!uniappIdPattern.test(manifest.appid)) {
35
+ return {
36
+ success: false,
37
+ error: `应用 ID 格式不正确: ${manifest.appid}。请使用 UniApp appid 格式(如 __UNI__7AE6056)`
38
+ };
39
+ }
40
+ return {
41
+ success: true,
42
+ manifest: {
43
+ appid: manifest.appid,
44
+ name: manifest.name,
45
+ description: manifest.description
46
+ }
47
+ };
48
+ }
49
+ //# sourceMappingURL=parseManifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseManifest.js","sourceRoot":"","sources":["../../../../src/functions/platform/uniapp/parseManifest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AA+BvD,MAAM,UAAU,aAAa,CAC3B,WAAmB,EACnB,IAAuB;IAGvB,MAAM,UAAU,GAAG,iBAAiB,CAAC,WAAW,EAAE;QAChD,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC,CAAA;IAEF,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;QACzB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,cAAc,EAAE,CAAA;IACtE,CAAC;IAED,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QAC7B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,uBAAuB,EAAE,CAAA;IAC3D,CAAC;IAED,IAAI,QAAa,CAAA;IACjB,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;QAC1E,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KA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AAA;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { UniApp } from '../../../references/uniapp.d';
2
+ import type { setTimeout } from '../../../references/timer.d';
3
+ export interface WaitForPagesDeps {
4
+ getCurrentPages: UniApp['getCurrentPages'];
5
+ setTimeout: typeof setTimeout;
6
+ }
7
+ export declare function waitForPages(deps: WaitForPagesDeps, timeout?: number): Promise<any[]>;
@@ -0,0 +1,20 @@
1
+ export function waitForPages(deps, timeout = 5000) {
2
+ return new Promise((resolve, reject) => {
3
+ const startTime = Date.now();
4
+ const checkPages = () => {
5
+ const pages = deps.getCurrentPages();
6
+ if (pages.length > 0) {
7
+ resolve(pages);
8
+ return;
9
+ }
10
+ if (Date.now() - startTime > timeout) {
11
+ reject(new Error('等待页面栈超时'));
12
+ return;
13
+ }
14
+ deps.setTimeout(checkPages, 100);
15
+ };
16
+ checkPages();
17
+ });
18
+ }
19
+ ;
20
+ //# sourceMappingURL=waitForPages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waitForPages.js","sourceRoot":"","sources":["../../../../src/functions/platform/uniapp/waitForPages.ts"],"names":[],"mappings":"AAwBA,MAAM,UAAU,YAAY,CAAC,IAAsB,EAAE,OAAO,GAAG,IAAI;IACjE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE7B,MAAM,UAAU,GAAG,GAAG,EAAE;YACtB,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;YAErC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrB,OAAO,CAAC,KAAK,CAAC,CAAC;gBACf,OAAO;YACT,CAAC;YAGD,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,CAAC;gBACrC,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;gBAC7B,OAAO;YACT,CAAC;YAGD,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QACnC,CAAC,CAAC;QAEF,UAAU,EAAE,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC;AAAA,CAAC"}
@@ -0,0 +1,39 @@
1
+ export interface RegexStep {
2
+ stepNumber: number;
3
+ textPosition: number;
4
+ regexPosition: number;
5
+ action: string;
6
+ status: 'matching' | 'matched' | 'failed' | 'backtrack';
7
+ matchedText: string;
8
+ captureGroups: CaptureGroupState[];
9
+ backtrackStack: BacktrackPoint[];
10
+ quantifierState?: QuantifierState;
11
+ explanation: string;
12
+ }
13
+ export interface CaptureGroupState {
14
+ index: number;
15
+ name?: string;
16
+ text: string;
17
+ completed: boolean;
18
+ }
19
+ export interface BacktrackPoint {
20
+ textPos: number;
21
+ regexPos: number;
22
+ description: string;
23
+ }
24
+ export interface QuantifierState {
25
+ symbol: string;
26
+ currentCount: number;
27
+ minCount: number;
28
+ maxCount: number;
29
+ greedy: boolean;
30
+ }
31
+ export interface RegexVisualization {
32
+ steps: RegexStep[];
33
+ finalMatch: {
34
+ success: boolean;
35
+ matchedText: string;
36
+ captureGroups: CaptureGroupState[];
37
+ };
38
+ }
39
+ export declare function visualizeRegexSteps(pattern: string, text: string, maxSteps?: number): RegexVisualization;
@@ -0,0 +1,446 @@
1
+ function parseSimpleRegex(pattern) {
2
+ const components = [];
3
+ let i = 0;
4
+ while (i < pattern.length) {
5
+ const char = pattern[i];
6
+ if (char === '\\' && i + 1 < pattern.length) {
7
+ components.push({
8
+ type: 'escape',
9
+ text: pattern.substring(i, i + 2),
10
+ value: pattern[i + 1]
11
+ });
12
+ i += 2;
13
+ continue;
14
+ }
15
+ if (['+', '*', '?'].includes(char)) {
16
+ const quantMap = {
17
+ '+': [1, Infinity],
18
+ '*': [0, Infinity],
19
+ '?': [0, 1]
20
+ };
21
+ const [min, max] = quantMap[char];
22
+ components.push({
23
+ type: 'quantifier',
24
+ text: char,
25
+ min,
26
+ max
27
+ });
28
+ i++;
29
+ continue;
30
+ }
31
+ if (char === '[') {
32
+ let j = i + 1;
33
+ while (j < pattern.length && pattern[j] !== ']') {
34
+ if (pattern[j] === '\\')
35
+ j++;
36
+ j++;
37
+ }
38
+ components.push({
39
+ type: 'charset',
40
+ text: pattern.substring(i, j + 1)
41
+ });
42
+ i = j + 1;
43
+ continue;
44
+ }
45
+ if (char === '(') {
46
+ let depth = 1;
47
+ let j = i + 1;
48
+ while (j < pattern.length && depth > 0) {
49
+ if (pattern[j] === '\\') {
50
+ j += 2;
51
+ continue;
52
+ }
53
+ if (pattern[j] === '(')
54
+ depth++;
55
+ if (pattern[j] === ')')
56
+ depth--;
57
+ j++;
58
+ }
59
+ components.push({
60
+ type: 'group',
61
+ text: pattern.substring(i, j)
62
+ });
63
+ i = j;
64
+ continue;
65
+ }
66
+ if (char === '^' || char === '$') {
67
+ components.push({
68
+ type: 'anchor',
69
+ text: char
70
+ });
71
+ i++;
72
+ continue;
73
+ }
74
+ components.push({
75
+ type: 'literal',
76
+ text: char,
77
+ value: char
78
+ });
79
+ i++;
80
+ }
81
+ return components;
82
+ }
83
+ function matchEscape(escapeChar, textChar) {
84
+ const escapeMap = {
85
+ 'd': (c) => /[0-9]/.test(c),
86
+ 'D': (c) => /[^0-9]/.test(c),
87
+ 'w': (c) => /[a-zA-Z0-9_]/.test(c),
88
+ 'W': (c) => /[^a-zA-Z0-9_]/.test(c),
89
+ 's': (c) => /\s/.test(c),
90
+ 'S': (c) => /\S/.test(c)
91
+ };
92
+ return escapeMap[escapeChar]?.(textChar) || false;
93
+ }
94
+ function matchCharset(charset, textChar) {
95
+ const isNegated = charset[1] === '^';
96
+ const chars = charset.substring(isNegated ? 2 : 1, charset.length - 1);
97
+ let matches = false;
98
+ for (let i = 0; i < chars.length; i++) {
99
+ if (chars[i + 1] === '-' && i + 2 < chars.length) {
100
+ const start = chars.charCodeAt(i);
101
+ const end = chars.charCodeAt(i + 2);
102
+ const code = textChar.charCodeAt(0);
103
+ if (code >= start && code <= end) {
104
+ matches = true;
105
+ break;
106
+ }
107
+ i += 2;
108
+ }
109
+ else {
110
+ if (chars[i] === textChar) {
111
+ matches = true;
112
+ break;
113
+ }
114
+ }
115
+ }
116
+ return isNegated ? !matches : matches;
117
+ }
118
+ function tryMatchAt(components, text, startPos, steps, stepNumber) {
119
+ let textPos = startPos;
120
+ let regexPos = 0;
121
+ let matchedText = '';
122
+ const captureGroups = [];
123
+ const backtrackStack = [];
124
+ steps.push({
125
+ stepNumber: stepNumber++,
126
+ textPosition: textPos,
127
+ regexPosition: regexPos,
128
+ action: `尝试从位置 ${startPos} 开始匹配`,
129
+ status: 'matching',
130
+ matchedText: '',
131
+ captureGroups: [],
132
+ backtrackStack: [],
133
+ explanation: `将正则引擎定位到文本位置 ${startPos},准备开始匹配`
134
+ });
135
+ while (regexPos < components.length && textPos < text.length) {
136
+ const component = components[regexPos];
137
+ const currentChar = text[textPos];
138
+ const nextComponent = components[regexPos + 1];
139
+ const hasQuantifier = nextComponent?.type === 'quantifier';
140
+ if (component.type === 'literal') {
141
+ steps.push({
142
+ stepNumber: stepNumber++,
143
+ textPosition: textPos,
144
+ regexPosition: regexPos,
145
+ action: `匹配字面字符 "${component.text}"`,
146
+ status: 'matching',
147
+ matchedText,
148
+ captureGroups: [...captureGroups],
149
+ backtrackStack: [...backtrackStack],
150
+ explanation: `检查文本位置 ${textPos} 的字符 "${currentChar}" 是否等于 "${component.text}"`
151
+ });
152
+ if (currentChar === component.value) {
153
+ matchedText += currentChar;
154
+ textPos++;
155
+ regexPos++;
156
+ steps.push({
157
+ stepNumber: stepNumber++,
158
+ textPosition: textPos,
159
+ regexPosition: regexPos,
160
+ action: '匹配成功',
161
+ status: 'matched',
162
+ matchedText,
163
+ captureGroups: [...captureGroups],
164
+ backtrackStack: [...backtrackStack],
165
+ explanation: `字符 "${currentChar}" 匹配成功,继续向前`
166
+ });
167
+ }
168
+ else {
169
+ steps.push({
170
+ stepNumber: stepNumber++,
171
+ textPosition: textPos,
172
+ regexPosition: regexPos,
173
+ action: '匹配失败',
174
+ status: 'failed',
175
+ matchedText,
176
+ captureGroups: [...captureGroups],
177
+ backtrackStack: [...backtrackStack],
178
+ explanation: `字符 "${currentChar}" 不匹配 "${component.text}",匹配失败`
179
+ });
180
+ break;
181
+ }
182
+ }
183
+ else if (component.type === 'escape') {
184
+ steps.push({
185
+ stepNumber: stepNumber++,
186
+ textPosition: textPos,
187
+ regexPosition: regexPos,
188
+ action: `匹配转义字符 ${component.text}`,
189
+ status: 'matching',
190
+ matchedText,
191
+ captureGroups: [...captureGroups],
192
+ backtrackStack: [...backtrackStack],
193
+ explanation: `检查文本位置 ${textPos} 的字符 "${currentChar}" 是否符合 ${component.text} 的规则`
194
+ });
195
+ if (matchEscape(component.value, currentChar)) {
196
+ if (hasQuantifier) {
197
+ const quantifier = nextComponent;
198
+ const quantState = {
199
+ symbol: quantifier.text,
200
+ currentCount: 0,
201
+ minCount: quantifier.min,
202
+ maxCount: quantifier.max,
203
+ greedy: true
204
+ };
205
+ steps.push({
206
+ stepNumber: stepNumber++,
207
+ textPosition: textPos,
208
+ regexPosition: regexPos,
209
+ action: `进入量词 ${quantifier.text}`,
210
+ status: 'matching',
211
+ matchedText,
212
+ captureGroups: [...captureGroups],
213
+ backtrackStack: [...backtrackStack],
214
+ quantifierState: quantState,
215
+ explanation: `检测到量词 ${quantifier.text},要求匹配 ${quantifier.min} 到 ${quantifier.max === Infinity ? '∞' : quantifier.max} 次`
216
+ });
217
+ let count = 0;
218
+ let tempPos = textPos;
219
+ while (count < quantifier.max && tempPos < text.length) {
220
+ const nextChar = text[tempPos];
221
+ if (matchEscape(component.value, nextChar)) {
222
+ matchedText += nextChar;
223
+ count++;
224
+ tempPos++;
225
+ quantState.currentCount = count;
226
+ steps.push({
227
+ stepNumber: stepNumber++,
228
+ textPosition: tempPos,
229
+ regexPosition: regexPos,
230
+ action: `量词匹配(第 ${count} 次)`,
231
+ status: 'matched',
232
+ matchedText,
233
+ captureGroups: [...captureGroups],
234
+ backtrackStack: [...backtrackStack],
235
+ quantifierState: { ...quantState },
236
+ explanation: `字符 "${nextChar}" 匹配成功,已匹配 ${count} 次`
237
+ });
238
+ }
239
+ else {
240
+ break;
241
+ }
242
+ }
243
+ if (count >= quantifier.min) {
244
+ textPos = tempPos;
245
+ regexPos += 2;
246
+ steps.push({
247
+ stepNumber: stepNumber++,
248
+ textPosition: textPos,
249
+ regexPosition: regexPos,
250
+ action: '✓ 量词匹配完成',
251
+ status: 'matched',
252
+ matchedText,
253
+ captureGroups: [...captureGroups],
254
+ backtrackStack: [...backtrackStack],
255
+ quantifierState: { ...quantState },
256
+ explanation: `量词 ${quantifier.text} 成功匹配 ${count} 次,满足要求 [${quantifier.min}, ${quantifier.max === Infinity ? '∞' : quantifier.max}]`
257
+ });
258
+ }
259
+ else {
260
+ steps.push({
261
+ stepNumber: stepNumber++,
262
+ textPosition: textPos,
263
+ regexPosition: regexPos,
264
+ action: '✗ 量词不满足',
265
+ status: 'failed',
266
+ matchedText,
267
+ captureGroups: [...captureGroups],
268
+ backtrackStack: [...backtrackStack],
269
+ quantifierState: { ...quantState },
270
+ explanation: `量词 ${quantifier.text} 只匹配 ${count} 次,不满足最小要求 ${quantifier.min}`
271
+ });
272
+ break;
273
+ }
274
+ }
275
+ else {
276
+ matchedText += currentChar;
277
+ textPos++;
278
+ regexPos++;
279
+ steps.push({
280
+ stepNumber: stepNumber++,
281
+ textPosition: textPos,
282
+ regexPosition: regexPos,
283
+ action: '✓ 匹配成功',
284
+ status: 'matched',
285
+ matchedText,
286
+ captureGroups: [...captureGroups],
287
+ backtrackStack: [...backtrackStack],
288
+ explanation: `字符 "${currentChar}" 符合 ${component.text} 规则`
289
+ });
290
+ }
291
+ }
292
+ else {
293
+ steps.push({
294
+ stepNumber: stepNumber++,
295
+ textPosition: textPos,
296
+ regexPosition: regexPos,
297
+ action: '匹配失败',
298
+ status: 'failed',
299
+ matchedText,
300
+ captureGroups: [...captureGroups],
301
+ backtrackStack: [...backtrackStack],
302
+ explanation: `字符 "${currentChar}" 不符合 ${component.text} 规则,匹配失败`
303
+ });
304
+ break;
305
+ }
306
+ }
307
+ else if (component.type === 'charset') {
308
+ steps.push({
309
+ stepNumber: stepNumber++,
310
+ textPosition: textPos,
311
+ regexPosition: regexPos,
312
+ action: `匹配字符集 ${component.text}`,
313
+ status: 'matching',
314
+ matchedText,
315
+ captureGroups: [...captureGroups],
316
+ backtrackStack: [...backtrackStack],
317
+ explanation: `检查字符 "${currentChar}" 是否在字符集 ${component.text} 中`
318
+ });
319
+ if (matchCharset(component.text, currentChar)) {
320
+ matchedText += currentChar;
321
+ textPos++;
322
+ regexPos++;
323
+ steps.push({
324
+ stepNumber: stepNumber++,
325
+ textPosition: textPos,
326
+ regexPosition: regexPos,
327
+ action: '匹配成功',
328
+ status: 'matched',
329
+ matchedText,
330
+ captureGroups: [...captureGroups],
331
+ backtrackStack: [...backtrackStack],
332
+ explanation: `字符 "${currentChar}" 在字符集中,匹配成功`
333
+ });
334
+ }
335
+ else {
336
+ steps.push({
337
+ stepNumber: stepNumber++,
338
+ textPosition: textPos,
339
+ regexPosition: regexPos,
340
+ action: '匹配失败',
341
+ status: 'failed',
342
+ matchedText,
343
+ captureGroups: [...captureGroups],
344
+ backtrackStack: [...backtrackStack],
345
+ explanation: `字符 "${currentChar}" 不在字符集中,匹配失败`
346
+ });
347
+ break;
348
+ }
349
+ }
350
+ else {
351
+ regexPos++;
352
+ }
353
+ }
354
+ const success = regexPos >= components.length;
355
+ if (success) {
356
+ steps.push({
357
+ stepNumber: stepNumber++,
358
+ textPosition: textPos,
359
+ regexPosition: regexPos,
360
+ action: '✅ 匹配成功',
361
+ status: 'matched',
362
+ matchedText,
363
+ captureGroups: [],
364
+ backtrackStack: [],
365
+ explanation: `所有模式都已匹配成功!最终匹配结果:"${matchedText}"`
366
+ });
367
+ }
368
+ else {
369
+ steps.push({
370
+ stepNumber: stepNumber++,
371
+ textPosition: textPos,
372
+ regexPosition: regexPos,
373
+ action: '❌ 本次尝试失败',
374
+ status: 'failed',
375
+ matchedText,
376
+ captureGroups: [],
377
+ backtrackStack: [],
378
+ explanation: `从位置 ${startPos} 开始的匹配尝试失败`
379
+ });
380
+ }
381
+ return { success, matchedText, steps, stepNumber };
382
+ }
383
+ export function visualizeRegexSteps(pattern, text, maxSteps = 200) {
384
+ const steps = [];
385
+ const components = parseSimpleRegex(pattern);
386
+ let stepNumber = 0;
387
+ steps.push({
388
+ stepNumber: stepNumber++,
389
+ textPosition: 0,
390
+ regexPosition: 0,
391
+ action: '🎬 开始正则匹配',
392
+ status: 'matching',
393
+ matchedText: '',
394
+ captureGroups: [],
395
+ backtrackStack: [],
396
+ explanation: `准备在文本中搜索模式 /${pattern}/,文本内容:"${text}"`
397
+ });
398
+ for (let i = 0; i < text.length; i++) {
399
+ const result = tryMatchAt(components, text, i, steps, stepNumber);
400
+ stepNumber = result.stepNumber;
401
+ if (result.success) {
402
+ return {
403
+ steps,
404
+ finalMatch: {
405
+ success: true,
406
+ matchedText: result.matchedText,
407
+ captureGroups: []
408
+ }
409
+ };
410
+ }
411
+ if (steps.length >= maxSteps) {
412
+ steps.push({
413
+ stepNumber: stepNumber++,
414
+ textPosition: i + 1,
415
+ regexPosition: 0,
416
+ action: '⏸ 步骤过多,暂停',
417
+ status: 'failed',
418
+ matchedText: '',
419
+ captureGroups: [],
420
+ backtrackStack: [],
421
+ explanation: `已生成 ${steps.length} 个步骤,为避免过长暂停执行`
422
+ });
423
+ break;
424
+ }
425
+ }
426
+ steps.push({
427
+ stepNumber: stepNumber++,
428
+ textPosition: text.length,
429
+ regexPosition: 0,
430
+ action: '❌ 匹配失败',
431
+ status: 'failed',
432
+ matchedText: '',
433
+ captureGroups: [],
434
+ backtrackStack: [],
435
+ explanation: `已扫描整个文本,未找到匹配项`
436
+ });
437
+ return {
438
+ steps,
439
+ finalMatch: {
440
+ success: false,
441
+ matchedText: '',
442
+ captureGroups: []
443
+ }
444
+ };
445
+ }
446
+ //# sourceMappingURL=visualizeRegexSteps.js.map