@el-j/magic-helix-core 4.0.0-beta.1 → 4.0.0-beta.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.
- package/dist/builtin-plugins/cpp/index.d.ts +46 -0
- package/dist/builtin-plugins/index.d.ts +1 -0
- package/dist/default_templates/generic/lang-typescript.md +49 -3
- package/dist/default_templates/generic/style-tailwind.md +72 -2
- package/dist/default_templates/generic/test-vitest.md +126 -1
- package/dist/default_templates/vue/vue-core.md +90 -10
- package/dist/{index-BkJhe5Af.js → index-0GK4RlUx.js} +2 -2
- package/dist/{index-BkJhe5Af.js.map → index-0GK4RlUx.js.map} +1 -1
- package/dist/{index-Jz0HYZ7B.js → index-BQ6v041y.js} +2 -2
- package/dist/index-BQ6v041y.js.map +1 -0
- package/dist/index-Baxb1vI_.js +210 -0
- package/dist/index-Baxb1vI_.js.map +1 -0
- package/dist/{index-L3IVvhd1.cjs → index-BqTqxCpG.cjs} +2 -2
- package/dist/{index-L3IVvhd1.cjs.map → index-BqTqxCpG.cjs.map} +1 -1
- package/dist/{index-Dm37u5ut.js → index-DkvW5yBY.js} +362 -241
- package/dist/index-DkvW5yBY.js.map +1 -0
- package/dist/index-Dn1ehjIj.cjs +80 -0
- package/dist/index-Dn1ehjIj.cjs.map +1 -0
- package/dist/index-nioXOg4m.cjs +76 -0
- package/dist/index-nioXOg4m.cjs.map +1 -0
- package/dist/{index-J1qAfsnO.cjs → index-okhY3fWD.cjs} +2 -2
- package/dist/index-okhY3fWD.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/plugin-loader.d.ts +5 -0
- package/package.json +1 -1
- package/dist/index-B_6W_RnJ.cjs +0 -76
- package/dist/index-B_6W_RnJ.cjs.map +0 -1
- package/dist/index-Dm37u5ut.js.map +0 -1
- package/dist/index-J1qAfsnO.cjs.map +0 -1
- package/dist/index-Jz0HYZ7B.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as a, D as i, G as s, a as u, b as g, M as l, P as o, c as t, R as e } from "./index-
|
|
1
|
+
import { C as a, D as i, G as s, a as u, b as g, M as l, P as o, c as t, R as e } from "./index-DkvW5yBY.js";
|
|
2
2
|
export {
|
|
3
3
|
a as CodeOwnersPlugin,
|
|
4
4
|
i as DockerPlugin,
|
|
@@ -10,4 +10,4 @@ export {
|
|
|
10
10
|
t as PythonPlugin,
|
|
11
11
|
e as RustPlugin
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=index-
|
|
13
|
+
//# sourceMappingURL=index-BQ6v041y.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BQ6v041y.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { B as u } from "./BasePlugin-6wv0hYJ9.js";
|
|
2
|
+
class g extends u {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments), this.name = "cpp", this.displayName = "C/C++", this.version = "3.0.0", this.priority = 85;
|
|
5
|
+
}
|
|
6
|
+
async detect(t) {
|
|
7
|
+
const i = [], s = {};
|
|
8
|
+
let r, n = this.getProjectName(t);
|
|
9
|
+
const e = await this.detectPlatformIO(t);
|
|
10
|
+
if (e && (i.push("platformio"), r = "platformio.ini", e.board && i.push(`board-${e.board}`), e.platform && (i.push(`platform-${e.platform}`), e.platform.includes("espressif32") && i.push("esp32"), e.platform.includes("espressif8266") && i.push("esp8266"), e.platform.includes("atmelavr") && i.push("arduino")), e.framework && (i.push(`framework-${e.framework}`), e.framework === "arduino" && i.push("arduino")), e.libs))
|
|
11
|
+
for (const a of e.libs)
|
|
12
|
+
s[a] = "*";
|
|
13
|
+
if (this.fileExists(t, "CMakeLists.txt")) {
|
|
14
|
+
i.push("cmake"), r || (r = "CMakeLists.txt");
|
|
15
|
+
const a = this.readFile(t, "CMakeLists.txt");
|
|
16
|
+
if (a) {
|
|
17
|
+
const c = a.match(/project\s*\(\s*([^\s)]+)/i);
|
|
18
|
+
c && (n = c[1]);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return (this.fileExists(t, "Makefile") || this.fileExists(t, "makefile")) && (i.push("makefile"), r || (r = "Makefile")), await this.hasFiles(t, "*.ino") && (i.push("arduino"), r || (r = "*.ino")), await this.hasFiles(t, "**/*.{cpp,c,h,hpp}") && (i.push("cpp"), r || (r = "*.cpp")), i.length === 0 ? null : {
|
|
22
|
+
language: "C/C++",
|
|
23
|
+
name: n,
|
|
24
|
+
dependencies: s,
|
|
25
|
+
manifestFile: r,
|
|
26
|
+
projectPath: t,
|
|
27
|
+
tags: i
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Parse platformio.ini configuration
|
|
32
|
+
*/
|
|
33
|
+
async detectPlatformIO(t) {
|
|
34
|
+
if (!this.fileExists(t, "platformio.ini"))
|
|
35
|
+
return null;
|
|
36
|
+
const i = this.readFile(t, "platformio.ini");
|
|
37
|
+
if (!i) return null;
|
|
38
|
+
const s = {
|
|
39
|
+
libs: []
|
|
40
|
+
}, r = i.split(`
|
|
41
|
+
`);
|
|
42
|
+
let n = !1, e = null;
|
|
43
|
+
for (const p of r) {
|
|
44
|
+
const o = p.trim();
|
|
45
|
+
if (o.startsWith("[env:")) {
|
|
46
|
+
n = !0, e = null;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (o.startsWith("[") && o.endsWith("]")) {
|
|
50
|
+
n = !1, e = null;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (n || !s.board) {
|
|
54
|
+
const l = o.match(/^(\w+)\s*=\s*(.*)$/);
|
|
55
|
+
if (l) {
|
|
56
|
+
const [, f, a] = l;
|
|
57
|
+
switch (e = f, f) {
|
|
58
|
+
case "board":
|
|
59
|
+
s.board = a.trim();
|
|
60
|
+
break;
|
|
61
|
+
case "platform":
|
|
62
|
+
s.platform = a.trim();
|
|
63
|
+
break;
|
|
64
|
+
case "framework":
|
|
65
|
+
s.framework = a.trim();
|
|
66
|
+
break;
|
|
67
|
+
case "lib_deps":
|
|
68
|
+
a.trim() && s.libs?.push(a.trim());
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
} else e === "lib_deps" && o && !o.startsWith("[") && s.libs?.push(o);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return s.board || s.platform ? s : null;
|
|
75
|
+
}
|
|
76
|
+
getTemplates() {
|
|
77
|
+
return [
|
|
78
|
+
{
|
|
79
|
+
name: "cpp-core",
|
|
80
|
+
tags: ["cpp"],
|
|
81
|
+
content: this.getCppTemplate()
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "platformio-core",
|
|
85
|
+
tags: ["platformio"],
|
|
86
|
+
content: this.getPlatformIOTemplate()
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: "arduino-core",
|
|
90
|
+
tags: ["arduino"],
|
|
91
|
+
content: this.getArduinoTemplate()
|
|
92
|
+
}
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
getDependencyTagMap() {
|
|
96
|
+
return {
|
|
97
|
+
// Common C++ libraries
|
|
98
|
+
boost: "boost",
|
|
99
|
+
fmt: "fmt",
|
|
100
|
+
spdlog: "spdlog",
|
|
101
|
+
googletest: "gtest",
|
|
102
|
+
catch2: "catch2",
|
|
103
|
+
// Arduino/PlatformIO libraries
|
|
104
|
+
"Adafruit GFX Library": "adafruit-gfx",
|
|
105
|
+
WiFi: "wifi",
|
|
106
|
+
ESP32: "esp32",
|
|
107
|
+
FastLED: "fastled",
|
|
108
|
+
ArduinoJson: "arduino-json"
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
getConfigFileTagMap() {
|
|
112
|
+
return {
|
|
113
|
+
"platformio.ini": "platformio",
|
|
114
|
+
"CMakeLists.txt": "cmake",
|
|
115
|
+
Makefile: "makefile",
|
|
116
|
+
".clang-format": "clang-format",
|
|
117
|
+
".clang-tidy": "clang-tidy"
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
getCppTemplate() {
|
|
121
|
+
return `# C/C++ Development Guidelines
|
|
122
|
+
|
|
123
|
+
This project uses C/C++.
|
|
124
|
+
|
|
125
|
+
## Project Structure
|
|
126
|
+
- Organize headers and implementation files clearly
|
|
127
|
+
- Use proper include guards or \`#pragma once\`
|
|
128
|
+
- Separate interface from implementation
|
|
129
|
+
|
|
130
|
+
## Code Style
|
|
131
|
+
- Follow modern C++ practices (C++11/14/17/20)
|
|
132
|
+
- Use RAII for resource management
|
|
133
|
+
- Prefer smart pointers over raw pointers
|
|
134
|
+
- Use const correctness
|
|
135
|
+
|
|
136
|
+
## Build System
|
|
137
|
+
- Use CMake or Makefile for build configuration
|
|
138
|
+
- Keep build files maintainable
|
|
139
|
+
- Document build dependencies
|
|
140
|
+
|
|
141
|
+
## Testing
|
|
142
|
+
- Write unit tests for core functionality
|
|
143
|
+
- Use GoogleTest, Catch2, or similar frameworks
|
|
144
|
+
- Test edge cases and error conditions
|
|
145
|
+
`;
|
|
146
|
+
}
|
|
147
|
+
getPlatformIOTemplate() {
|
|
148
|
+
return `# PlatformIO Development Guidelines
|
|
149
|
+
|
|
150
|
+
This is a PlatformIO embedded project.
|
|
151
|
+
|
|
152
|
+
## Project Structure
|
|
153
|
+
- Source code in \`src/\`
|
|
154
|
+
- Libraries in \`lib/\`
|
|
155
|
+
- Include files in \`include/\`
|
|
156
|
+
- Tests in \`test/\`
|
|
157
|
+
|
|
158
|
+
## Development Workflow
|
|
159
|
+
- Use PlatformIO CLI or IDE for building
|
|
160
|
+
- Test on hardware early and often
|
|
161
|
+
- Use serial monitor for debugging
|
|
162
|
+
- Manage dependencies via \`platformio.ini\`
|
|
163
|
+
|
|
164
|
+
## Code Practices
|
|
165
|
+
- Keep \`setup()\` and \`loop()\` focused
|
|
166
|
+
- Use proper pin definitions
|
|
167
|
+
- Handle interrupts carefully
|
|
168
|
+
- Consider power consumption
|
|
169
|
+
|
|
170
|
+
## Hardware Integration
|
|
171
|
+
- Document pin configurations
|
|
172
|
+
- Test hardware connections before coding
|
|
173
|
+
- Use appropriate voltage levels
|
|
174
|
+
- Follow manufacturer datasheets
|
|
175
|
+
`;
|
|
176
|
+
}
|
|
177
|
+
getArduinoTemplate() {
|
|
178
|
+
return `# Arduino Development Guidelines
|
|
179
|
+
|
|
180
|
+
This is an Arduino project.
|
|
181
|
+
|
|
182
|
+
## Project Structure
|
|
183
|
+
- Main sketch (.ino file)
|
|
184
|
+
- Additional tabs for organization
|
|
185
|
+
- Libraries in Arduino libraries folder
|
|
186
|
+
|
|
187
|
+
## Code Practices
|
|
188
|
+
- Use \`setup()\` for initialization
|
|
189
|
+
- Keep \`loop()\` non-blocking when possible
|
|
190
|
+
- Use \`delay()\` sparingly
|
|
191
|
+
- Free resources properly
|
|
192
|
+
|
|
193
|
+
## Hardware
|
|
194
|
+
- Document pin assignments
|
|
195
|
+
- Use proper resistor values
|
|
196
|
+
- Consider current limitations
|
|
197
|
+
- Test connections before powering
|
|
198
|
+
|
|
199
|
+
## Debugging
|
|
200
|
+
- Use Serial.print() for debugging
|
|
201
|
+
- Check Serial Monitor baud rate
|
|
202
|
+
- Validate sensor readings
|
|
203
|
+
- Test incrementally
|
|
204
|
+
`;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
export {
|
|
208
|
+
g as CppPlugin
|
|
209
|
+
};
|
|
210
|
+
//# sourceMappingURL=index-Baxb1vI_.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Baxb1vI_.js","sources":["../src/builtin-plugins/cpp/index.ts"],"sourcesContent":["/**\n * C/C++ Language Plugin\n *\n * Detects C/C++ projects via:\n * - platformio.ini (PlatformIO/ESP32/Arduino)\n * - CMakeLists.txt (CMake)\n * - Makefile\n * - *.ino files (Arduino sketches)\n * - .cpp/.h files\n */\n\nimport type { ProjectMetadata, TemplateDefinition } from '../../types';\nimport { BasePlugin } from '../base/BasePlugin';\n\ninterface PlatformIOConfig {\n board?: string;\n platform?: string;\n framework?: string;\n libs?: string[];\n}\n\nexport class CppPlugin extends BasePlugin {\n name = 'cpp';\n displayName = 'C/C++';\n version = '3.0.0';\n priority = 85;\n\n async detect(projectPath: string): Promise<ProjectMetadata | null> {\n const tags: string[] = [];\n const dependencies: Record<string, string> = {};\n let manifestFile: string | undefined;\n let projectName = this.getProjectName(projectPath);\n\n // Detect PlatformIO project\n const platformioConfig = await this.detectPlatformIO(projectPath);\n if (platformioConfig) {\n tags.push('platformio');\n manifestFile = 'platformio.ini';\n\n if (platformioConfig.board) {\n tags.push(`board-${platformioConfig.board}`);\n }\n if (platformioConfig.platform) {\n tags.push(`platform-${platformioConfig.platform}`);\n\n // Common platforms\n if (platformioConfig.platform.includes('espressif32')) {\n tags.push('esp32');\n }\n if (platformioConfig.platform.includes('espressif8266')) {\n tags.push('esp8266');\n }\n if (platformioConfig.platform.includes('atmelavr')) {\n tags.push('arduino');\n }\n }\n if (platformioConfig.framework) {\n tags.push(`framework-${platformioConfig.framework}`);\n if (platformioConfig.framework === 'arduino') {\n tags.push('arduino');\n }\n }\n if (platformioConfig.libs) {\n for (const lib of platformioConfig.libs) {\n dependencies[lib] = '*';\n }\n }\n }\n\n // Detect CMake project\n const hasCMake = this.fileExists(projectPath, 'CMakeLists.txt');\n if (hasCMake) {\n tags.push('cmake');\n if (!manifestFile) manifestFile = 'CMakeLists.txt';\n\n // Try to extract project name from CMakeLists.txt\n const cmakeContent = this.readFile(projectPath, 'CMakeLists.txt');\n if (cmakeContent) {\n const projectMatch = cmakeContent.match(/project\\s*\\(\\s*([^\\s)]+)/i);\n if (projectMatch) {\n projectName = projectMatch[1];\n }\n }\n }\n\n // Detect Makefile\n const hasMakefile =\n this.fileExists(projectPath, 'Makefile') ||\n this.fileExists(projectPath, 'makefile');\n if (hasMakefile) {\n tags.push('makefile');\n if (!manifestFile) manifestFile = 'Makefile';\n }\n\n // Detect Arduino sketches\n const hasIno = await this.hasFiles(projectPath, '*.ino');\n if (hasIno) {\n tags.push('arduino');\n if (!manifestFile) manifestFile = '*.ino';\n }\n\n // Detect C++ source files\n const hasCpp = await this.hasFiles(projectPath, '**/*.{cpp,c,h,hpp}');\n if (hasCpp) {\n tags.push('cpp');\n if (!manifestFile) manifestFile = '*.cpp';\n }\n\n // Must have at least one C++ indicator\n if (tags.length === 0) {\n return null;\n }\n\n return {\n language: 'C/C++',\n name: projectName,\n dependencies,\n manifestFile,\n projectPath,\n tags,\n };\n }\n\n /**\n * Parse platformio.ini configuration\n */\n private async detectPlatformIO(\n projectPath: string,\n ): Promise<PlatformIOConfig | null> {\n if (!this.fileExists(projectPath, 'platformio.ini')) {\n return null;\n }\n\n const content = this.readFile(projectPath, 'platformio.ini');\n if (!content) return null;\n\n const config: PlatformIOConfig = {\n libs: [],\n };\n\n const lines = content.split('\\n');\n let inEnv = false;\n let currentKey: string | null = null;\n\n for (const line of lines) {\n const trimmed = line.trim();\n\n // Detect environment section\n if (trimmed.startsWith('[env:')) {\n inEnv = true;\n currentKey = null;\n continue;\n }\n if (trimmed.startsWith('[') && trimmed.endsWith(']')) {\n inEnv = false;\n currentKey = null;\n continue;\n }\n\n if (inEnv || !config.board) {\n // Parse key-value pairs\n const match = trimmed.match(/^(\\w+)\\s*=\\s*(.*)$/);\n if (match) {\n const [, key, value] = match;\n currentKey = key;\n switch (key) {\n case 'board':\n config.board = value.trim();\n break;\n case 'platform':\n config.platform = value.trim();\n break;\n case 'framework':\n config.framework = value.trim();\n break;\n case 'lib_deps':\n // lib_deps can be multiline, value might be empty if libs are on next lines\n if (value.trim()) {\n config.libs?.push(value.trim());\n }\n break;\n }\n } else if (\n currentKey === 'lib_deps' &&\n trimmed &&\n !trimmed.startsWith('[')\n ) {\n // Continuation line for lib_deps (indented library names)\n config.libs?.push(trimmed);\n }\n }\n }\n\n return config.board || config.platform ? config : null;\n }\n\n getTemplates(): TemplateDefinition[] {\n return [\n {\n name: 'cpp-core',\n tags: ['cpp'],\n content: this.getCppTemplate(),\n },\n {\n name: 'platformio-core',\n tags: ['platformio'],\n content: this.getPlatformIOTemplate(),\n },\n {\n name: 'arduino-core',\n tags: ['arduino'],\n content: this.getArduinoTemplate(),\n },\n ];\n }\n\n getDependencyTagMap() {\n return {\n // Common C++ libraries\n boost: 'boost',\n fmt: 'fmt',\n spdlog: 'spdlog',\n googletest: 'gtest',\n catch2: 'catch2',\n\n // Arduino/PlatformIO libraries\n 'Adafruit GFX Library': 'adafruit-gfx',\n WiFi: 'wifi',\n ESP32: 'esp32',\n FastLED: 'fastled',\n ArduinoJson: 'arduino-json',\n };\n }\n\n getConfigFileTagMap() {\n return {\n 'platformio.ini': 'platformio',\n 'CMakeLists.txt': 'cmake',\n Makefile: 'makefile',\n '.clang-format': 'clang-format',\n '.clang-tidy': 'clang-tidy',\n };\n }\n\n private getCppTemplate(): string {\n return `# C/C++ Development Guidelines\n\nThis project uses C/C++.\n\n## Project Structure\n- Organize headers and implementation files clearly\n- Use proper include guards or \\`#pragma once\\`\n- Separate interface from implementation\n\n## Code Style\n- Follow modern C++ practices (C++11/14/17/20)\n- Use RAII for resource management\n- Prefer smart pointers over raw pointers\n- Use const correctness\n\n## Build System\n- Use CMake or Makefile for build configuration\n- Keep build files maintainable\n- Document build dependencies\n\n## Testing\n- Write unit tests for core functionality\n- Use GoogleTest, Catch2, or similar frameworks\n- Test edge cases and error conditions\n`;\n }\n\n private getPlatformIOTemplate(): string {\n return `# PlatformIO Development Guidelines\n\nThis is a PlatformIO embedded project.\n\n## Project Structure\n- Source code in \\`src/\\`\n- Libraries in \\`lib/\\`\n- Include files in \\`include/\\`\n- Tests in \\`test/\\`\n\n## Development Workflow\n- Use PlatformIO CLI or IDE for building\n- Test on hardware early and often\n- Use serial monitor for debugging\n- Manage dependencies via \\`platformio.ini\\`\n\n## Code Practices\n- Keep \\`setup()\\` and \\`loop()\\` focused\n- Use proper pin definitions\n- Handle interrupts carefully\n- Consider power consumption\n\n## Hardware Integration\n- Document pin configurations\n- Test hardware connections before coding\n- Use appropriate voltage levels\n- Follow manufacturer datasheets\n`;\n }\n\n private getArduinoTemplate(): string {\n return `# Arduino Development Guidelines\n\nThis is an Arduino project.\n\n## Project Structure\n- Main sketch (.ino file)\n- Additional tabs for organization\n- Libraries in Arduino libraries folder\n\n## Code Practices\n- Use \\`setup()\\` for initialization\n- Keep \\`loop()\\` non-blocking when possible\n- Use \\`delay()\\` sparingly\n- Free resources properly\n\n## Hardware\n- Document pin assignments\n- Use proper resistor values\n- Consider current limitations\n- Test connections before powering\n\n## Debugging\n- Use Serial.print() for debugging\n- Check Serial Monitor baud rate\n- Validate sensor readings\n- Test incrementally\n`;\n }\n}\n"],"names":["CppPlugin","BasePlugin","projectPath","tags","dependencies","manifestFile","projectName","platformioConfig","lib","cmakeContent","projectMatch","content","config","lines","inEnv","currentKey","line","trimmed","match","key","value"],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const index=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const index=require("./index-nioXOg4m.cjs"),BasePlugin=require("./BasePlugin-odQJAKA-.cjs");var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getAugmentedNamespace(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var r=t.default;if(typeof r=="function"){var a=function e(){var i=!1;try{i=this instanceof e}catch{}return i?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};a.prototype=r.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(t).forEach(function(e){var i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(a,e,i.get?i:{enumerable:!0,get:function(){return t[e]}})}),a}var toml={},parse={exports:{}},tomlParser={exports:{}},parser,hasRequiredParser;function requireParser(){if(hasRequiredParser)return parser;hasRequiredParser=1;const t=1114112;class r extends Error{constructor(n,o,c){super("[ParserError] "+n,o,c),this.name="ParserError",this.code="ParserError",Error.captureStackTrace&&Error.captureStackTrace(this,r)}}class a{constructor(n){this.parser=n,this.buf="",this.returned=null,this.result=null,this.resultTable=null,this.resultArr=null}}class e{constructor(){this.pos=0,this.col=0,this.line=0,this.obj={},this.ctx=this.obj,this.stack=[],this._buf="",this.char=null,this.ii=0,this.state=new a(this.parseStart)}parse(n){if(n.length===0||n.length==null)return;this._buf=String(n),this.ii=-1,this.char=-1;let o;for(;o===!1||this.nextChar();)o=this.runOne();this._buf=null}nextChar(){return this.char===10&&(++this.line,this.col=-1),++this.ii,this.char=this._buf.codePointAt(this.ii),++this.pos,++this.col,this.haveBuffer()}haveBuffer(){return this.ii<this._buf.length}runOne(){return this.state.parser.call(this,this.state.returned)}finish(){this.char=t;let n;do n=this.state.parser,this.runOne();while(this.state.parser!==n);return this.ctx=null,this.state=null,this._buf=null,this.obj}next(n){if(typeof n!="function")throw new r("Tried to set state to non-existent state: "+JSON.stringify(n));this.state.parser=n}goto(n){return this.next(n),this.runOne()}call(n,o){o&&this.next(o),this.stack.push(this.state),this.state=new a(n)}callNow(n,o){return this.call(n,o),this.runOne()}return(n){if(this.stack.length===0)throw this.error(new r("Stack underflow"));n===void 0&&(n=this.state.buf),this.state=this.stack.pop(),this.state.returned=n}returnNow(n){return this.return(n),this.runOne()}consume(){if(this.char===t)throw this.error(new r("Unexpected end-of-buffer"));this.state.buf+=this._buf[this.ii]}error(n){return n.line=this.line,n.col=this.col,n.pos=this.pos,n}parseStart(){throw new r("Must declare a parseStart method")}}return e.END=t,e.Error=r,parser=e,parser}var createDatetime,hasRequiredCreateDatetime;function requireCreateDatetime(){return hasRequiredCreateDatetime||(hasRequiredCreateDatetime=1,createDatetime=t=>{const r=new Date(t);if(isNaN(r))throw new TypeError("Invalid Datetime");return r}),createDatetime}var formatNum,hasRequiredFormatNum;function requireFormatNum(){return hasRequiredFormatNum||(hasRequiredFormatNum=1,formatNum=(t,r)=>{for(r=String(r);r.length<t;)r="0"+r;return r}),formatNum}var createDatetimeFloat,hasRequiredCreateDatetimeFloat;function requireCreateDatetimeFloat(){if(hasRequiredCreateDatetimeFloat)return createDatetimeFloat;hasRequiredCreateDatetimeFloat=1;const t=requireFormatNum();class r extends Date{constructor(e){super(e+"Z"),this.isFloating=!0}toISOString(){const e=`${this.getUTCFullYear()}-${t(2,this.getUTCMonth()+1)}-${t(2,this.getUTCDate())}`,i=`${t(2,this.getUTCHours())}:${t(2,this.getUTCMinutes())}:${t(2,this.getUTCSeconds())}.${t(3,this.getUTCMilliseconds())}`;return`${e}T${i}`}}return createDatetimeFloat=a=>{const e=new r(a);if(isNaN(e))throw new TypeError("Invalid Datetime");return e},createDatetimeFloat}var createDate,hasRequiredCreateDate;function requireCreateDate(){if(hasRequiredCreateDate)return createDate;hasRequiredCreateDate=1;const t=requireFormatNum(),r=commonjsGlobal.Date;class a extends r{constructor(i){super(i),this.isDate=!0}toISOString(){return`${this.getUTCFullYear()}-${t(2,this.getUTCMonth()+1)}-${t(2,this.getUTCDate())}`}}return createDate=e=>{const i=new a(e);if(isNaN(i))throw new TypeError("Invalid Datetime");return i},createDate}var createTime,hasRequiredCreateTime;function requireCreateTime(){if(hasRequiredCreateTime)return createTime;hasRequiredCreateTime=1;const t=requireFormatNum();class r extends Date{constructor(e){super(`0000-01-01T${e}Z`),this.isTime=!0}toISOString(){return`${t(2,this.getUTCHours())}:${t(2,this.getUTCMinutes())}:${t(2,this.getUTCSeconds())}.${t(3,this.getUTCMilliseconds())}`}}return createTime=a=>{const e=new r(a);if(isNaN(e))throw new TypeError("Invalid Datetime");return e},createTime}var hasRequiredTomlParser;function requireTomlParser(){if(hasRequiredTomlParser)return tomlParser.exports;hasRequiredTomlParser=1,tomlParser.exports=makeParserClass(requireParser()),tomlParser.exports.makeParserClass=makeParserClass;class TomlError extends Error{constructor(r){super(r),this.name="TomlError",Error.captureStackTrace&&Error.captureStackTrace(this,TomlError),this.fromTOML=!0,this.wrapped=null}}TomlError.wrap=t=>{const r=new TomlError(t.message);return r.code=t.code,r.wrapped=t,r},tomlParser.exports.TomlError=TomlError;const createDateTime=requireCreateDatetime(),createDateTimeFloat=requireCreateDatetimeFloat(),createDate=requireCreateDate(),createTime=requireCreateTime(),CTRL_I=9,CTRL_J=10,CTRL_M=13,CTRL_CHAR_BOUNDARY=31,CHAR_SP=32,CHAR_QUOT=34,CHAR_NUM=35,CHAR_APOS=39,CHAR_PLUS=43,CHAR_COMMA=44,CHAR_HYPHEN=45,CHAR_PERIOD=46,CHAR_0=48,CHAR_1=49,CHAR_7=55,CHAR_9=57,CHAR_COLON=58,CHAR_EQUALS=61,CHAR_A=65,CHAR_E=69,CHAR_F=70,CHAR_T=84,CHAR_U=85,CHAR_Z=90,CHAR_LOWBAR=95,CHAR_a=97,CHAR_b=98,CHAR_e=101,CHAR_f=102,CHAR_i=105,CHAR_l=108,CHAR_n=110,CHAR_o=111,CHAR_r=114,CHAR_s=115,CHAR_t=116,CHAR_u=117,CHAR_x=120,CHAR_z=122,CHAR_LCUB=123,CHAR_RCUB=125,CHAR_LSQB=91,CHAR_BSOL=92,CHAR_RSQB=93,CHAR_DEL=127,SURROGATE_FIRST=55296,SURROGATE_LAST=57343,escapes={[CHAR_b]:"\b",[CHAR_t]:" ",[CHAR_n]:`
|
|
2
2
|
`,[CHAR_f]:"\f",[CHAR_r]:"\r",[CHAR_QUOT]:'"',[CHAR_BSOL]:"\\"};function isDigit(t){return t>=CHAR_0&&t<=CHAR_9}function isHexit(t){return t>=CHAR_A&&t<=CHAR_F||t>=CHAR_a&&t<=CHAR_f||t>=CHAR_0&&t<=CHAR_9}function isBit(t){return t===CHAR_1||t===CHAR_0}function isOctit(t){return t>=CHAR_0&&t<=CHAR_7}function isAlphaNumQuoteHyphen(t){return t>=CHAR_A&&t<=CHAR_Z||t>=CHAR_a&&t<=CHAR_z||t>=CHAR_0&&t<=CHAR_9||t===CHAR_APOS||t===CHAR_QUOT||t===CHAR_LOWBAR||t===CHAR_HYPHEN}function isAlphaNumHyphen(t){return t>=CHAR_A&&t<=CHAR_Z||t>=CHAR_a&&t<=CHAR_z||t>=CHAR_0&&t<=CHAR_9||t===CHAR_LOWBAR||t===CHAR_HYPHEN}const _type=Symbol("type"),_declared=Symbol("declared"),hasOwnProperty=Object.prototype.hasOwnProperty,defineProperty=Object.defineProperty,descriptor={configurable:!0,enumerable:!0,writable:!0,value:void 0};function hasKey(t,r){return hasOwnProperty.call(t,r)?!0:(r==="__proto__"&&defineProperty(t,"__proto__",descriptor),!1)}const INLINE_TABLE=Symbol("inline-table");function InlineTable(){return Object.defineProperties({},{[_type]:{value:INLINE_TABLE}})}function isInlineTable(t){return t===null||typeof t!="object"?!1:t[_type]===INLINE_TABLE}const TABLE=Symbol("table");function Table(){return Object.defineProperties({},{[_type]:{value:TABLE},[_declared]:{value:!1,writable:!0}})}function isTable(t){return t===null||typeof t!="object"?!1:t[_type]===TABLE}const _contentType=Symbol("content-type"),INLINE_LIST=Symbol("inline-list");function InlineList(t){return Object.defineProperties([],{[_type]:{value:INLINE_LIST},[_contentType]:{value:t}})}function isInlineList(t){return t===null||typeof t!="object"?!1:t[_type]===INLINE_LIST}const LIST=Symbol("list");function List(){return Object.defineProperties([],{[_type]:{value:LIST}})}function isList(t){return t===null||typeof t!="object"?!1:t[_type]===LIST}let _custom;try{const utilInspect=eval("require('util').inspect");_custom=utilInspect.custom}catch(t){}const _inspect=_custom||"inspect";class BoxedBigInt{constructor(r){try{this.value=commonjsGlobal.BigInt.asIntN(64,r)}catch{this.value=null}Object.defineProperty(this,_type,{value:INTEGER})}isNaN(){return this.value===null}toString(){return String(this.value)}[_inspect](){return`[BigInt: ${this.toString()}]}`}valueOf(){return this.value}}const INTEGER=Symbol("integer");function Integer(t){let r=Number(t);return Object.is(r,-0)&&(r=0),commonjsGlobal.BigInt&&!Number.isSafeInteger(r)?new BoxedBigInt(t):Object.defineProperties(new Number(r),{isNaN:{value:function(){return isNaN(this)}},[_type]:{value:INTEGER},[_inspect]:{value:()=>`[Integer: ${t}]`}})}function isInteger(t){return t===null||typeof t!="object"?!1:t[_type]===INTEGER}const FLOAT=Symbol("float");function Float(t){return Object.defineProperties(new Number(t),{[_type]:{value:FLOAT},[_inspect]:{value:()=>`[Float: ${t}]`}})}function isFloat(t){return t===null||typeof t!="object"?!1:t[_type]===FLOAT}function tomlType(t){const r=typeof t;if(r==="object"){if(t===null)return"null";if(t instanceof Date)return"datetime";if(_type in t)switch(t[_type]){case INLINE_TABLE:return"inline-table";case INLINE_LIST:return"inline-list";case TABLE:return"table";case LIST:return"list";case FLOAT:return"float";case INTEGER:return"integer"}}return r}function makeParserClass(t){class r extends t{constructor(){super(),this.ctx=this.obj=Table()}atEndOfWord(){return this.char===CHAR_NUM||this.char===CTRL_I||this.char===CHAR_SP||this.atEndOfLine()}atEndOfLine(){return this.char===t.END||this.char===CTRL_J||this.char===CTRL_M}parseStart(){if(this.char===t.END)return null;if(this.char===CHAR_LSQB)return this.call(this.parseTableOrList);if(this.char===CHAR_NUM)return this.call(this.parseComment);if(this.char===CTRL_J||this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M)return null;if(isAlphaNumQuoteHyphen(this.char))return this.callNow(this.parseAssignStatement);throw this.error(new TomlError(`Unknown character "${this.char}"`))}parseWhitespaceToEOL(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M)return null;if(this.char===CHAR_NUM)return this.goto(this.parseComment);if(this.char===t.END||this.char===CTRL_J)return this.return();throw this.error(new TomlError("Unexpected character, expected only whitespace or comments till end of line"))}parseAssignStatement(){return this.callNow(this.parseAssign,this.recordAssignStatement)}recordAssignStatement(e){let i=this.ctx,n=e.key.pop();for(let o of e.key){if(hasKey(i,o)&&!isTable(i[o]))throw this.error(new TomlError("Can't redefine existing key"));i=i[o]=i[o]||Table()}if(hasKey(i,n))throw this.error(new TomlError("Can't redefine existing key"));return i[_declared]=!0,isInteger(e.value)||isFloat(e.value)?i[n]=e.value.valueOf():i[n]=e.value,this.goto(this.parseWhitespaceToEOL)}parseAssign(){return this.callNow(this.parseKeyword,this.recordAssignKeyword)}recordAssignKeyword(e){return this.state.resultTable?this.state.resultTable.push(e):this.state.resultTable=[e],this.goto(this.parseAssignKeywordPreDot)}parseAssignKeywordPreDot(){if(this.char===CHAR_PERIOD)return this.next(this.parseAssignKeywordPostDot);if(this.char!==CHAR_SP&&this.char!==CTRL_I)return this.goto(this.parseAssignEqual)}parseAssignKeywordPostDot(){if(this.char!==CHAR_SP&&this.char!==CTRL_I)return this.callNow(this.parseKeyword,this.recordAssignKeyword)}parseAssignEqual(){if(this.char===CHAR_EQUALS)return this.next(this.parseAssignPreValue);throw this.error(new TomlError('Invalid character, expected "="'))}parseAssignPreValue(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseValue,this.recordAssignValue)}recordAssignValue(e){return this.returnNow({key:this.state.resultTable,value:e})}parseComment(){do{if(this.char===t.END||this.char===CTRL_J)return this.return();if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I)throw this.errorControlCharIn("comments")}while(this.nextChar())}parseTableOrList(){if(this.char===CHAR_LSQB)this.next(this.parseList);else return this.goto(this.parseTable)}parseTable(){return this.ctx=this.obj,this.goto(this.parseTableNext)}parseTableNext(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseKeyword,this.parseTableMore)}parseTableMore(e){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CHAR_RSQB){if(hasKey(this.ctx,e)&&(!isTable(this.ctx[e])||this.ctx[e][_declared]))throw this.error(new TomlError("Can't redefine existing key"));return this.ctx=this.ctx[e]=this.ctx[e]||Table(),this.ctx[_declared]=!0,this.next(this.parseWhitespaceToEOL)}else if(this.char===CHAR_PERIOD){if(!hasKey(this.ctx,e))this.ctx=this.ctx[e]=Table();else if(isTable(this.ctx[e]))this.ctx=this.ctx[e];else if(isList(this.ctx[e]))this.ctx=this.ctx[e][this.ctx[e].length-1];else throw this.error(new TomlError("Can't redefine existing key"));return this.next(this.parseTableNext)}else throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"))}parseList(){return this.ctx=this.obj,this.goto(this.parseListNext)}parseListNext(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseKeyword,this.parseListMore)}parseListMore(e){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CHAR_RSQB){if(hasKey(this.ctx,e)||(this.ctx[e]=List()),isInlineList(this.ctx[e]))throw this.error(new TomlError("Can't extend an inline array"));if(isList(this.ctx[e])){const i=Table();this.ctx[e].push(i),this.ctx=i}else throw this.error(new TomlError("Can't redefine an existing key"));return this.next(this.parseListEnd)}else if(this.char===CHAR_PERIOD){if(!hasKey(this.ctx,e))this.ctx=this.ctx[e]=Table();else{if(isInlineList(this.ctx[e]))throw this.error(new TomlError("Can't extend an inline array"));if(isInlineTable(this.ctx[e]))throw this.error(new TomlError("Can't extend an inline table"));if(isList(this.ctx[e]))this.ctx=this.ctx[e][this.ctx[e].length-1];else if(isTable(this.ctx[e]))this.ctx=this.ctx[e];else throw this.error(new TomlError("Can't redefine an existing key"))}return this.next(this.parseListNext)}else throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"))}parseListEnd(e){if(this.char===CHAR_RSQB)return this.next(this.parseWhitespaceToEOL);throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"))}parseValue(){if(this.char===t.END)throw this.error(new TomlError("Key without value"));if(this.char===CHAR_QUOT)return this.next(this.parseDoubleString);if(this.char===CHAR_APOS)return this.next(this.parseSingleString);if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)return this.goto(this.parseNumberSign);if(this.char===CHAR_i)return this.next(this.parseInf);if(this.char===CHAR_n)return this.next(this.parseNan);if(isDigit(this.char))return this.goto(this.parseNumberOrDateTime);if(this.char===CHAR_t||this.char===CHAR_f)return this.goto(this.parseBoolean);if(this.char===CHAR_LSQB)return this.call(this.parseInlineList,this.recordValue);if(this.char===CHAR_LCUB)return this.call(this.parseInlineTable,this.recordValue);throw this.error(new TomlError("Unexpected character, expecting string, number, datetime, boolean, inline array or inline table"))}recordValue(e){return this.returnNow(e)}parseInf(){if(this.char===CHAR_n)return this.next(this.parseInf2);throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'))}parseInf2(){if(this.char===CHAR_f)return this.state.buf==="-"?this.return(-1/0):this.return(1/0);throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'))}parseNan(){if(this.char===CHAR_a)return this.next(this.parseNan2);throw this.error(new TomlError('Unexpected character, expected "nan"'))}parseNan2(){if(this.char===CHAR_n)return this.return(NaN);throw this.error(new TomlError('Unexpected character, expected "nan"'))}parseKeyword(){return this.char===CHAR_QUOT?this.next(this.parseBasicString):this.char===CHAR_APOS?this.next(this.parseLiteralString):this.goto(this.parseBareKey)}parseBareKey(){do{if(this.char===t.END)throw this.error(new TomlError("Key ended without value"));if(isAlphaNumHyphen(this.char))this.consume();else{if(this.state.buf.length===0)throw this.error(new TomlError("Empty bare keys are not allowed"));return this.returnNow()}}while(this.nextChar())}parseSingleString(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiStringMaybe):this.goto(this.parseLiteralString)}parseLiteralString(){do{if(this.char===CHAR_APOS)return this.return();if(this.atEndOfLine())throw this.error(new TomlError("Unterminated string"));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I)throw this.errorControlCharIn("strings");this.consume()}while(this.nextChar())}parseLiteralMultiStringMaybe(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiString):this.returnNow()}parseLiteralMultiString(){return this.char===CTRL_M?null:this.char===CTRL_J?this.next(this.parseLiteralMultiStringContent):this.goto(this.parseLiteralMultiStringContent)}parseLiteralMultiStringContent(){do{if(this.char===CHAR_APOS)return this.next(this.parseLiteralMultiEnd);if(this.char===t.END)throw this.error(new TomlError("Unterminated multi-line string"));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I&&this.char!==CTRL_J&&this.char!==CTRL_M)throw this.errorControlCharIn("strings");this.consume()}while(this.nextChar())}parseLiteralMultiEnd(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiEnd2):(this.state.buf+="'",this.goto(this.parseLiteralMultiStringContent))}parseLiteralMultiEnd2(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiEnd3):(this.state.buf+="''",this.goto(this.parseLiteralMultiStringContent))}parseLiteralMultiEnd3(){return this.char===CHAR_APOS?(this.state.buf+="'",this.next(this.parseLiteralMultiEnd4)):this.returnNow()}parseLiteralMultiEnd4(){return this.char===CHAR_APOS?(this.state.buf+="'",this.return()):this.returnNow()}parseDoubleString(){return this.char===CHAR_QUOT?this.next(this.parseMultiStringMaybe):this.goto(this.parseBasicString)}parseBasicString(){do{if(this.char===CHAR_BSOL)return this.call(this.parseEscape,this.recordEscapeReplacement);if(this.char===CHAR_QUOT)return this.return();if(this.atEndOfLine())throw this.error(new TomlError("Unterminated string"));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I)throw this.errorControlCharIn("strings");this.consume()}while(this.nextChar())}recordEscapeReplacement(e){return this.state.buf+=e,this.goto(this.parseBasicString)}parseMultiStringMaybe(){return this.char===CHAR_QUOT?this.next(this.parseMultiString):this.returnNow()}parseMultiString(){return this.char===CTRL_M?null:this.char===CTRL_J?this.next(this.parseMultiStringContent):this.goto(this.parseMultiStringContent)}parseMultiStringContent(){do{if(this.char===CHAR_BSOL)return this.call(this.parseMultiEscape,this.recordMultiEscapeReplacement);if(this.char===CHAR_QUOT)return this.next(this.parseMultiEnd);if(this.char===t.END)throw this.error(new TomlError("Unterminated multi-line string"));if(this.char===CHAR_DEL||this.char<=CTRL_CHAR_BOUNDARY&&this.char!==CTRL_I&&this.char!==CTRL_J&&this.char!==CTRL_M)throw this.errorControlCharIn("strings");this.consume()}while(this.nextChar())}errorControlCharIn(e){let i="\\u00";return this.char<16&&(i+="0"),i+=this.char.toString(16),this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in ${e}, use ${i} instead`))}recordMultiEscapeReplacement(e){return this.state.buf+=e,this.goto(this.parseMultiStringContent)}parseMultiEnd(){return this.char===CHAR_QUOT?this.next(this.parseMultiEnd2):(this.state.buf+='"',this.goto(this.parseMultiStringContent))}parseMultiEnd2(){return this.char===CHAR_QUOT?this.next(this.parseMultiEnd3):(this.state.buf+='""',this.goto(this.parseMultiStringContent))}parseMultiEnd3(){return this.char===CHAR_QUOT?(this.state.buf+='"',this.next(this.parseMultiEnd4)):this.returnNow()}parseMultiEnd4(){return this.char===CHAR_QUOT?(this.state.buf+='"',this.return()):this.returnNow()}parseMultiEscape(){return this.char===CTRL_M||this.char===CTRL_J?this.next(this.parseMultiTrim):this.char===CHAR_SP||this.char===CTRL_I?this.next(this.parsePreMultiTrim):this.goto(this.parseEscape)}parsePreMultiTrim(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CTRL_M||this.char===CTRL_J)return this.next(this.parseMultiTrim);throw this.error(new TomlError("Can't escape whitespace"))}parseMultiTrim(){return this.char===CTRL_J||this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M?null:this.returnNow()}parseEscape(){if(this.char in escapes)return this.return(escapes[this.char]);if(this.char===CHAR_u)return this.call(this.parseSmallUnicode,this.parseUnicodeReturn);if(this.char===CHAR_U)return this.call(this.parseLargeUnicode,this.parseUnicodeReturn);throw this.error(new TomlError("Unknown escape character: "+this.char))}parseUnicodeReturn(e){try{const i=parseInt(e,16);if(i>=SURROGATE_FIRST&&i<=SURROGATE_LAST)throw this.error(new TomlError("Invalid unicode, character in range 0xD800 - 0xDFFF is reserved"));return this.returnNow(String.fromCodePoint(i))}catch(i){throw this.error(TomlError.wrap(i))}}parseSmallUnicode(){if(isHexit(this.char)){if(this.consume(),this.state.buf.length>=4)return this.return()}else throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"))}parseLargeUnicode(){if(isHexit(this.char)){if(this.consume(),this.state.buf.length>=8)return this.return()}else throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"))}parseNumberSign(){return this.consume(),this.next(this.parseMaybeSignedInfOrNan)}parseMaybeSignedInfOrNan(){return this.char===CHAR_i?this.next(this.parseInf):this.char===CHAR_n?this.next(this.parseNan):this.callNow(this.parseNoUnder,this.parseNumberIntegerStart)}parseNumberIntegerStart(){return this.char===CHAR_0?(this.consume(),this.next(this.parseNumberIntegerExponentOrDecimal)):this.goto(this.parseNumberInteger)}parseNumberIntegerExponentOrDecimal(){return this.char===CHAR_PERIOD?(this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat)):this.char===CHAR_E||this.char===CHAR_e?(this.consume(),this.next(this.parseNumberExponentSign)):this.returnNow(Integer(this.state.buf))}parseNumberInteger(){if(isDigit(this.char))this.consume();else{if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder);if(this.char===CHAR_E||this.char===CHAR_e)return this.consume(),this.next(this.parseNumberExponentSign);if(this.char===CHAR_PERIOD)return this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat);{const e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(e)}}}parseNoUnder(){if(this.char===CHAR_LOWBAR||this.char===CHAR_PERIOD||this.char===CHAR_E||this.char===CHAR_e)throw this.error(new TomlError("Unexpected character, expected digit"));if(this.atEndOfWord())throw this.error(new TomlError("Incomplete number"));return this.returnNow()}parseNoUnderHexOctBinLiteral(){if(this.char===CHAR_LOWBAR||this.char===CHAR_PERIOD)throw this.error(new TomlError("Unexpected character, expected digit"));if(this.atEndOfWord())throw this.error(new TomlError("Incomplete number"));return this.returnNow()}parseNumberFloat(){if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder,this.parseNumberFloat);if(isDigit(this.char))this.consume();else return this.char===CHAR_E||this.char===CHAR_e?(this.consume(),this.next(this.parseNumberExponentSign)):this.returnNow(Float(this.state.buf))}parseNumberExponentSign(){if(isDigit(this.char))return this.goto(this.parseNumberExponent);if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.call(this.parseNoUnder,this.parseNumberExponent);else throw this.error(new TomlError("Unexpected character, expected -, + or digit"))}parseNumberExponent(){if(isDigit(this.char))this.consume();else return this.char===CHAR_LOWBAR?this.call(this.parseNoUnder):this.returnNow(Float(this.state.buf))}parseNumberOrDateTime(){return this.char===CHAR_0?(this.consume(),this.next(this.parseNumberBaseOrDateTime)):this.goto(this.parseNumberOrDateTimeOnly)}parseNumberOrDateTimeOnly(){if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder,this.parseNumberInteger);if(isDigit(this.char))this.consume(),this.state.buf.length>4&&this.next(this.parseNumberInteger);else return this.char===CHAR_E||this.char===CHAR_e?(this.consume(),this.next(this.parseNumberExponentSign)):this.char===CHAR_PERIOD?(this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat)):this.char===CHAR_HYPHEN?this.goto(this.parseDateTime):this.char===CHAR_COLON?this.goto(this.parseOnlyTimeHour):this.returnNow(Integer(this.state.buf))}parseDateTimeOnly(){if(this.state.buf.length<4){if(isDigit(this.char))return this.consume();if(this.char===CHAR_COLON)return this.goto(this.parseOnlyTimeHour);throw this.error(new TomlError("Expected digit while parsing year part of a date"))}else{if(this.char===CHAR_HYPHEN)return this.goto(this.parseDateTime);throw this.error(new TomlError("Expected hyphen (-) while parsing year part of date"))}}parseNumberBaseOrDateTime(){return this.char===CHAR_b?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerBin)):this.char===CHAR_o?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerOct)):this.char===CHAR_x?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerHex)):this.char===CHAR_PERIOD?this.goto(this.parseNumberInteger):isDigit(this.char)?this.goto(this.parseDateTimeOnly):this.returnNow(Integer(this.state.buf))}parseIntegerHex(){if(isHexit(this.char))this.consume();else{if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);{const e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(e)}}}parseIntegerOct(){if(isOctit(this.char))this.consume();else{if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);{const e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(e)}}}parseIntegerBin(){if(isBit(this.char))this.consume();else{if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);{const e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(e)}}}parseDateTime(){if(this.state.buf.length<4)throw this.error(new TomlError("Years less than 1000 must be zero padded to four characters"));return this.state.result=this.state.buf,this.state.buf="",this.next(this.parseDateMonth)}parseDateMonth(){if(this.char===CHAR_HYPHEN){if(this.state.buf.length<2)throw this.error(new TomlError("Months less than 10 must be zero padded to two characters"));return this.state.result+="-"+this.state.buf,this.state.buf="",this.next(this.parseDateDay)}else if(isDigit(this.char))this.consume();else throw this.error(new TomlError("Incomplete datetime"))}parseDateDay(){if(this.char===CHAR_T||this.char===CHAR_SP){if(this.state.buf.length<2)throw this.error(new TomlError("Days less than 10 must be zero padded to two characters"));return this.state.result+="-"+this.state.buf,this.state.buf="",this.next(this.parseStartTimeHour)}else{if(this.atEndOfWord())return this.returnNow(createDate(this.state.result+"-"+this.state.buf));if(isDigit(this.char))this.consume();else throw this.error(new TomlError("Incomplete datetime"))}}parseStartTimeHour(){return this.atEndOfWord()?this.returnNow(createDate(this.state.result)):this.goto(this.parseTimeHour)}parseTimeHour(){if(this.char===CHAR_COLON){if(this.state.buf.length<2)throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));return this.state.result+="T"+this.state.buf,this.state.buf="",this.next(this.parseTimeMin)}else if(isDigit(this.char))this.consume();else throw this.error(new TomlError("Incomplete datetime"))}parseTimeMin(){if(this.state.buf.length<2&&isDigit(this.char))this.consume();else{if(this.state.buf.length===2&&this.char===CHAR_COLON)return this.state.result+=":"+this.state.buf,this.state.buf="",this.next(this.parseTimeSec);throw this.error(new TomlError("Incomplete datetime"))}}parseTimeSec(){if(isDigit(this.char)){if(this.consume(),this.state.buf.length===2)return this.state.result+=":"+this.state.buf,this.state.buf="",this.next(this.parseTimeZoneOrFraction)}else throw this.error(new TomlError("Incomplete datetime"))}parseOnlyTimeHour(){if(this.char===CHAR_COLON){if(this.state.buf.length<2)throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));return this.state.result=this.state.buf,this.state.buf="",this.next(this.parseOnlyTimeMin)}else throw this.error(new TomlError("Incomplete time"))}parseOnlyTimeMin(){if(this.state.buf.length<2&&isDigit(this.char))this.consume();else{if(this.state.buf.length===2&&this.char===CHAR_COLON)return this.state.result+=":"+this.state.buf,this.state.buf="",this.next(this.parseOnlyTimeSec);throw this.error(new TomlError("Incomplete time"))}}parseOnlyTimeSec(){if(isDigit(this.char)){if(this.consume(),this.state.buf.length===2)return this.next(this.parseOnlyTimeFractionMaybe)}else throw this.error(new TomlError("Incomplete time"))}parseOnlyTimeFractionMaybe(){if(this.state.result+=":"+this.state.buf,this.char===CHAR_PERIOD)this.state.buf="",this.next(this.parseOnlyTimeFraction);else return this.return(createTime(this.state.result))}parseOnlyTimeFraction(){if(isDigit(this.char))this.consume();else if(this.atEndOfWord()){if(this.state.buf.length===0)throw this.error(new TomlError("Expected digit in milliseconds"));return this.returnNow(createTime(this.state.result+"."+this.state.buf))}else throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"))}parseTimeZoneOrFraction(){if(this.char===CHAR_PERIOD)this.consume(),this.next(this.parseDateTimeFraction);else if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.next(this.parseTimeZoneHour);else{if(this.char===CHAR_Z)return this.consume(),this.return(createDateTime(this.state.result+this.state.buf));if(this.atEndOfWord())return this.returnNow(createDateTimeFloat(this.state.result+this.state.buf));throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"))}}parseDateTimeFraction(){if(isDigit(this.char))this.consume();else{if(this.state.buf.length===1)throw this.error(new TomlError("Expected digit in milliseconds"));if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)this.consume(),this.next(this.parseTimeZoneHour);else{if(this.char===CHAR_Z)return this.consume(),this.return(createDateTime(this.state.result+this.state.buf));if(this.atEndOfWord())return this.returnNow(createDateTimeFloat(this.state.result+this.state.buf));throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"))}}}parseTimeZoneHour(){if(isDigit(this.char)){if(this.consume(),/\d\d$/.test(this.state.buf))return this.next(this.parseTimeZoneSep)}else throw this.error(new TomlError("Unexpected character in datetime, expected digit"))}parseTimeZoneSep(){if(this.char===CHAR_COLON)this.consume(),this.next(this.parseTimeZoneMin);else throw this.error(new TomlError("Unexpected character in datetime, expected colon"))}parseTimeZoneMin(){if(isDigit(this.char)){if(this.consume(),/\d\d$/.test(this.state.buf))return this.return(createDateTime(this.state.result+this.state.buf))}else throw this.error(new TomlError("Unexpected character in datetime, expected digit"))}parseBoolean(){if(this.char===CHAR_t)return this.consume(),this.next(this.parseTrue_r);if(this.char===CHAR_f)return this.consume(),this.next(this.parseFalse_a)}parseTrue_r(){if(this.char===CHAR_r)return this.consume(),this.next(this.parseTrue_u);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseTrue_u(){if(this.char===CHAR_u)return this.consume(),this.next(this.parseTrue_e);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseTrue_e(){if(this.char===CHAR_e)return this.return(!0);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_a(){if(this.char===CHAR_a)return this.consume(),this.next(this.parseFalse_l);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_l(){if(this.char===CHAR_l)return this.consume(),this.next(this.parseFalse_s);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_s(){if(this.char===CHAR_s)return this.consume(),this.next(this.parseFalse_e);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_e(){if(this.char===CHAR_e)return this.return(!1);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseInlineList(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M||this.char===CTRL_J)return null;if(this.char===t.END)throw this.error(new TomlError("Unterminated inline array"));return this.char===CHAR_NUM?this.call(this.parseComment):this.char===CHAR_RSQB?this.return(this.state.resultArr||InlineList()):this.callNow(this.parseValue,this.recordInlineListValue)}recordInlineListValue(e){return this.state.resultArr||(this.state.resultArr=InlineList(tomlType(e))),isFloat(e)||isInteger(e)?this.state.resultArr.push(e.valueOf()):this.state.resultArr.push(e),this.goto(this.parseInlineListNext)}parseInlineListNext(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M||this.char===CTRL_J)return null;if(this.char===CHAR_NUM)return this.call(this.parseComment);if(this.char===CHAR_COMMA)return this.next(this.parseInlineList);if(this.char===CHAR_RSQB)return this.goto(this.parseInlineList);throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"))}parseInlineTable(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===t.END||this.char===CHAR_NUM||this.char===CTRL_J||this.char===CTRL_M)throw this.error(new TomlError("Unterminated inline array"));return this.char===CHAR_RCUB?this.return(this.state.resultTable||InlineTable()):(this.state.resultTable||(this.state.resultTable=InlineTable()),this.callNow(this.parseAssign,this.recordInlineTableValue))}recordInlineTableValue(e){let i=this.state.resultTable,n=e.key.pop();for(let o of e.key){if(hasKey(i,o)&&(!isTable(i[o])||i[o][_declared]))throw this.error(new TomlError("Can't redefine existing key"));i=i[o]=i[o]||Table()}if(hasKey(i,n))throw this.error(new TomlError("Can't redefine existing key"));return isInteger(e.value)||isFloat(e.value)?i[n]=e.value.valueOf():i[n]=e.value,this.goto(this.parseInlineTableNext)}parseInlineTableNext(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===t.END||this.char===CHAR_NUM||this.char===CTRL_J||this.char===CTRL_M)throw this.error(new TomlError("Unterminated inline array"));if(this.char===CHAR_COMMA)return this.next(this.parseInlineTablePostComma);if(this.char===CHAR_RCUB)return this.goto(this.parseInlineTable);throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"))}parseInlineTablePostComma(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===t.END||this.char===CHAR_NUM||this.char===CTRL_J||this.char===CTRL_M)throw this.error(new TomlError("Unterminated inline array"));if(this.char===CHAR_COMMA)throw this.error(new TomlError("Empty elements in inline tables are not permitted"));if(this.char===CHAR_RCUB)throw this.error(new TomlError("Trailing commas in inline tables are not permitted"));return this.goto(this.parseInlineTable)}}return r}return tomlParser.exports}var parsePrettyError,hasRequiredParsePrettyError;function requireParsePrettyError(){if(hasRequiredParsePrettyError)return parsePrettyError;hasRequiredParsePrettyError=1,parsePrettyError=t;function t(r,a){if(r.pos==null||r.line==null)return r;let e=r.message;if(e+=` at row ${r.line+1}, col ${r.col+1}, pos ${r.pos}:
|
|
3
3
|
`,a&&a.split){const i=a.split(/\n/),n=String(Math.min(i.length,r.line+3)).length;let o=" ";for(;o.length<n;)o+=" ";for(let c=Math.max(0,r.line-1);c<Math.min(i.length,r.line+2);++c){let f=String(c+1);if(f.length<n&&(f=" "+f),r.line===c){e+=f+"> "+i[c]+`
|
|
4
4
|
`,e+=o+" ";for(let u=0;u<r.col;++u)e+=" ";e+=`^
|
|
@@ -86,4 +86,4 @@ These guidelines focus on packages aligned with the hardware2rust stack.
|
|
|
86
86
|
- Provide VS Code + probe-rs launch.json snippets for teammates
|
|
87
87
|
- Keep CI workflows building representative targets to catch regressions early`}]}getDependencyTagMap(){return{tokio:"rust-async","actix-web":"rust-actix",rocket:"rust-rocket",serde:"serde","embedded-hal":"rust-embedded","embedded-hal-async":"rust-embedded","cortex-m":"rust-embedded","cortex-m-rt":"rust-embedded","cortex-m-rtic":"rust-embedded",rtic:"rust-embedded",hardware2rust:"hardware2rust","probe-run":"rust-embedded","probe-rs":"rust-embedded",defmt:"rust-embedded",heapless:"rust-embedded","rp2040-hal":"rust-embedded","nrf52840-hal":"rust-embedded","stm32f4xx-hal":"rust-embedded","esp-idf-hal":"rust-embedded"}}parseManifest(r){try{return tomlExports.parse(r)}catch{return null}}extractDependenciesFromManifest(r){const a={};if(this.collectDependencies(r.dependencies,a),this.collectDependencies(r["dev-dependencies"],a),this.collectDependencies(r["build-dependencies"],a),this.collectDependencies(r.workspace?.dependencies,a),r.target)for(const e of Object.values(r.target))e&&(this.collectDependencies(e.dependencies,a),this.collectDependencies(e["dev-dependencies"],a),this.collectDependencies(e["build-dependencies"],a));return a}collectDependencies(r,a){if(r)for(const[e,i]of Object.entries(r))a[e]=this.normalizeDependencyVersion(i)}normalizeDependencyVersion(r){if(typeof r=="string"||typeof r=="number")return String(r);if(typeof r=="boolean")return r?"*":"disabled";if(r&&typeof r=="object"){const a=r,e=a.version;if(typeof e=="string")return e;const i=a.git;if(typeof i=="string"){const o=a.rev;return typeof o=="string"?`git:${i}#${o}`:`git:${i}`}const n=a.path;if(typeof n=="string")return`path:${n}`}return"*"}extractWorkspaceMembers(r,a){return r?.workspace?.members?.length?r.workspace.members.map(e=>e.trim()).filter(Boolean):this.fallbackWorkspaceMembers(a)}fallbackWorkspaceMembers(r){const a=r.match(/\[workspace\][\s\S]*?members\s*=\s*\[([\s\S]*?)\]/);return a?a[1].split(",").map(e=>e.trim().replace(/['"]/g,"")).filter(Boolean):[]}extractDependenciesFromText(r){const a={},e=["dependencies","dev-dependencies","build-dependencies","workspace.dependencies"];for(const i of e){const n=this.extractSection(r,i);n&&this.parseDependencyLines(n,a)}return a}extractSection(r,a){const e=a.replace(".","\\."),n=new RegExp(`\\[${e}\\]([\\s\\S]*?)(?:\\n\\[|$)`,"i").exec(r);return n?n[1]:null}parseDependencyLines(r,a){const e=r.split(`
|
|
88
88
|
`);for(const i of e){const n=i.trim();if(!n||n.startsWith("#"))continue;const o=n.match(/^([A-Za-z0-9_-]+)\s*=\s*(.+)$/);if(!o)continue;const[,c,f]=o,u=f.trim();if(u.startsWith("{")){const d=u.match(/version\s*=\s*"([^"]+)"/),R=u.match(/git\s*=\s*"([^"]+)"/),g=u.match(/path\s*=\s*"([^"]+)"/);a[c]=d?.[1]||(R?`git:${R}`:g?`path:${g}`:"*")}else a[c]=u.replace(/"/g,"")}}extractNameFromContent(r){return r.match(/\[package\][\s\S]*?name\s*=\s*"([^"]+)"/)?.[1]}extractDescriptionFromContent(r){return r.match(/\[package\][\s\S]*?description\s*=\s*"([^"]+)"/)?.[1]}async computeProjectTags(r,a,e,i){const n=new Set(["lang-rust"]),o=Object.keys(a).map(p=>p.toLowerCase()),c=o.some(p=>C.EMBEDDED_DEPENDENCIES.has(p)),f=(e?.package?.keywords??[]).map(p=>p.toLowerCase()),u=(e?.package?.categories??[]).map(p=>p.toLowerCase()),d=f.some(p=>C.EMBEDDED_KEYWORDS.has(p)),R=u.some(p=>C.EMBEDDED_KEYWORDS.has(p)),g=C.MEMORY_LAYOUT_FILES.some(p=>this.fileExists(r,p)),w=C.CARGO_CONFIG_FILES.some(p=>this.fileExists(r,p)),x=e?.package?.name?.toLowerCase()??"",T=i.toLowerCase(),E=C.HARDWARE_NAME_HINTS.some(p=>x.includes(p)||T.includes(p)),y=x.includes("hardware2rust")||o.some(p=>p.includes("hardware2rust"));return(c||d||R||g||w||E)&&n.add("rust-embedded"),y&&n.add("hardware2rust"),Array.from(n)}};C.EMBEDDED_DEPENDENCIES=new Set(["hardware2rust","embedded-hal","embedded-hal-async","cortex-m","cortex-m-rt","cortex-m-rtic","rtic","nrf52840-hal","atsamd-hal","stm32f4xx-hal","stm32h7xx-hal","esp-idf-hal","esp-hal","rp2040-hal","probe-run","probe-rs","defmt","heapless","microbit","drone-core"].map(r=>r.toLowerCase())),C.EMBEDDED_KEYWORDS=new Set(["embedded","hardware","no_std","nostd","microcontroller","firmware","hal","baremetal","bare-metal"]),C.HARDWARE_NAME_HINTS=["hardware","hardware2rust","embedded"],C.CARGO_CONFIG_FILES=[".cargo/config",".cargo/config.toml"],C.MEMORY_LAYOUT_FILES=["memory.x","memory.x.in"];let RustPlugin=C;exports.RustPlugin=RustPlugin;
|
|
89
|
-
//# sourceMappingURL=index-
|
|
89
|
+
//# sourceMappingURL=index-BqTqxCpG.cjs.map
|