MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / mergePlatform

Method mergePlatform

tools/mcmanifest.js:2937–3007  ·  view source on GitHub ↗
(all, platform)

Source from the content-addressed store, hash-verified

2935 });
2936 }
2937 mergePlatform(all, platform) {
2938 this.mergeProperties(all.config, platform.config);
2939 this.mergeProperties(all.creation, platform.creation);
2940 if (platform.creation)
2941 all.creation.has = true; // indicates that at least one manifest contains a creation. used by mcconfig.
2942 this.mergeProperties(all.defines, platform.defines);
2943
2944 this.concatProperties(all.data, platform.data, true);
2945 this.concatProperties(all.modules, platform.modules, true);
2946 this.concatProperties(all.resources, platform.resources, true);
2947 this.concatProperties(all.ble, platform.ble, true);
2948 this.concatProperties(all.recipes, platform.recipes);
2949
2950 all.commonjs = this.concatProperty(all.commonjs, platform.commonjs);
2951 all.preload = this.concatProperty(all.preload, platform.preload);
2952 all.strip = platform.strip ? platform.strip : all.strip;
2953 all.errors = this.concatProperty(all.errors, platform.error);
2954 all.warnings = this.concatProperty(all.warnings, platform.warning);
2955 this.mergeProperties(all.run, platform.run);
2956 this.mergeProperties(all.zephyrConfig, platform.zephyrConfig);
2957 this.mergeProperties(all.zephyrShields, platform.zephyrShields);
2958 this.mergeProperties(all.zephyrOverlay, platform.zephyrOverlay);
2959 if (platform.typescript) {
2960 let tsconfig = platform.typescript.tsconfig;
2961 if (tsconfig) {
2962 tsconfig = JSON.parse(JSON.stringify(tsconfig), (name, value) => {
2963 if ("string" === typeof value)
2964 value = this.resolveVariable(value);
2965 return value;
2966 });
2967
2968 this.mergeProperties(all.typescript.tsconfig, tsconfig, ['compilerOptions']);
2969 const compilerOptions = tsconfig.compilerOptions;
2970 for (let name in compilerOptions) {
2971 let value = compilerOptions[name];
2972 if ("types" === name)
2973 value = value.map(path => this.resolveSource(path));
2974 if ("object" === typeof value) {
2975 if (value instanceof Array) {
2976 all.typescript.tsconfig.compilerOptions[name] ??= [];
2977 all.typescript.tsconfig.compilerOptions[name] = value.concat(all.typescript.tsconfig.compilerOptions[name]);
2978 }
2979 else {
2980 all.typescript.tsconfig.compilerOptions[name] ??= {};
2981 this.mergeProperties(all.typescript.tsconfig.compilerOptions[name], value);
2982 }
2983 }
2984 else
2985 all.typescript.tsconfig.compilerOptions[name] = value;
2986 }
2987 }
2988
2989 all.typescript.compiler = platform.typescript.compiler ?? all.typescript.compiler;
2990 }
2991 if (platform.ffi) {
2992 if (!all.ffi) {
2993 all.ffi = {
2994 sources: [],

Callers 1

mergeManifestMethod · 0.95

Calls 8

mergePropertiesMethod · 0.95
concatPropertiesMethod · 0.95
concatPropertyMethod · 0.95
resolveVariableMethod · 0.95
resolveSourceMethod · 0.95
mapMethod · 0.80
parseMethod · 0.65
concatMethod · 0.65

Tested by

no test coverage detected