MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / Acode

Class Acode

src/lib/acode.js:78–1044  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76import config from "./config";
77
78class Acode {
79 #modules = {};
80 #pluginsInit = {};
81 #pluginUnmount = {};
82 // Registered formatter implementations (populated by plugins)
83 #formatter = [];
84 #pluginWatchers = {};
85
86 /**
87 * Clear a plugin's broken mark (so it can be retried)
88 * @param {string} pluginId
89 */
90 clearBrokenPluginMark(pluginId) {
91 try {
92 if (BROKEN_PLUGINS.has(pluginId)) {
93 BROKEN_PLUGINS.delete(pluginId);
94 }
95 } catch (e) {
96 console.warn("Failed to clear broken plugin mark:", e);
97 }
98 }
99
100 constructor() {
101 const encodingsModule = {
102 get encodings() {
103 return encodings;
104 },
105 encode,
106 decode,
107 };
108
109 const themesModule = {
110 add: themes.add,
111 get: themes.get,
112 list: themes.list,
113 update: themes.update,
114 // Deprecated, not supported anymore
115 apply: () => {},
116 };
117
118 // CodeMirror editor theme API for plugins
119 const normalizeThemeSpec = (spec) => {
120 if (!spec || typeof spec !== "object" || Array.isArray(spec)) {
121 console.warn(
122 "[editorThemes] register(spec) expects an object: { id, caption?, dark?, getExtension|extensions|extension|theme, config? }",
123 );
124 return null;
125 }
126
127 const id = spec.id || spec.name;
128 if (!id) {
129 console.warn("[editorThemes] register(spec) requires a valid `id`.");
130 return null;
131 }
132
133 const extensionSource =
134 spec.getExtension || spec.extensions || spec.extension || spec.theme;
135 if (extensionSource === undefined || extensionSource === null) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected