MCPcopy Index your code
hub / github.com/alibaba/lowcode-engine / setEngineOptions

Method setEngineOptions

packages/editor-core/src/config.ts:267–287  ·  view source on GitHub ↗

* if engineOptions.strictPluginMode === true, only accept propertied predefined in EngineOptions. * * @param {IPublicTypeEngineOptions} engineOptions

(engineOptions: IPublicTypeEngineOptions)

Source from the content-addressed store, hash-verified

265 * @param {IPublicTypeEngineOptions} engineOptions
266 */
267 setEngineOptions(engineOptions: IPublicTypeEngineOptions) {
268 if (!engineOptions || !isPlainObject(engineOptions)) {
269 return;
270 }
271 const strictMode = getStrictModeValue(engineOptions, STRICT_PLUGIN_MODE_DEFAULT) === true;
272 if (strictMode) {
273 const isValidKey = (key: string) => {
274 const result = (VALID_ENGINE_OPTIONS as any)[key];
275 return !(result === undefined || result === null);
276 };
277 Object.keys(engineOptions).forEach((key) => {
278 if (isValidKey(key)) {
279 this.set(key, (engineOptions as any)[key]);
280 } else {
281 logger.warn(`failed to config ${key} to engineConfig, only predefined options can be set under strict mode, predefined options: `, VALID_ENGINE_OPTIONS);
282 }
283 });
284 } else {
285 this.setConfig(engineOptions as any);
286 }
287 }
288
289 /**
290 * 获取指定 key 的值,若此时还未赋值,则等待,若已有值,则直接返回值

Callers

nothing calls this directly

Calls 6

setMethod · 0.95
setConfigMethod · 0.95
getStrictModeValueFunction · 0.85
forEachMethod · 0.65
warnMethod · 0.65
isPlainObjectFunction · 0.50

Tested by

no test coverage detected