src/PluginInfo/PluginInfo.js
changed.
Other files ignored by Codecov
spec/PluginInfo/PluginInfo.spec.js
has changed.
64 | 64 | * @return {Object} { key : default | null} |
|
65 | 65 | */ |
|
66 | 66 | getPreferences (platform) { |
|
67 | + | // XML passthrough for preferences is not supported because multiple preferences will override each other. |
|
68 | + | // https://github.com/apache/cordova-common/issues/182 |
|
69 | + | // return this._getTags('preference', platform).map(({ attrib }) => { |
|
70 | + | // return Object.assign({}, attrib, { |
|
71 | + | // [attrib.name.toUpperCase()]: attrib.default || null |
|
72 | + | // }); |
|
73 | + | // }) |
|
67 | 74 | return this._getTags('preference', platform).map(({ attrib }) => ({ |
|
68 | 75 | [attrib.name.toUpperCase()]: attrib.default || null |
|
69 | 76 | })) |
84 | 91 | throw new Error(`Malformed <asset> tag. Both "src" and "target" attributes must be specified in ${this.filepath}`); |
|
85 | 92 | } |
|
86 | 93 | ||
87 | - | return { itemType: 'asset', src, target }; |
|
94 | + | return Object.assign({}, attrib, { |
|
95 | + | itemType: 'asset', src, target |
|
96 | + | }); |
|
88 | 97 | }); |
|
89 | 98 | } |
|
90 | 99 |
105 | 114 | throw new CordovaError(`<dependency> tag is missing id attribute in ${this.filepath}`); |
|
106 | 115 | } |
|
107 | 116 | ||
108 | - | return { |
|
117 | + | return Object.assign({}, attrib, { |
|
109 | 118 | id: attrib.id, |
|
110 | 119 | version: attrib.version || '', |
|
111 | 120 | url: attrib.url || '', |
|
112 | 121 | subdir: attrib.subdir || '', |
|
113 | 122 | commit: attrib.commit, |
|
114 | 123 | git_ref: attrib.commit |
|
115 | - | }; |
|
124 | + | }); |
|
116 | 125 | }); |
|
117 | 126 | } |
|
118 | 127 |
122 | 131 | * @param {string} platform |
|
123 | 132 | */ |
|
124 | 133 | getConfigFiles (platform) { |
|
125 | - | return this._getTags('config-file', platform).map(tag => ({ |
|
126 | - | target: tag.attrib.target, |
|
127 | - | parent: tag.attrib.parent, |
|
128 | - | after: tag.attrib.after, |
|
129 | - | xmls: tag.getchildren(), |
|
130 | - | // To support demuxing via versions |
|
131 | - | versions: tag.attrib.versions, |
|
132 | - | deviceTarget: tag.attrib['device-target'] |
|
133 | - | })); |
|
134 | + | return this._getTags('config-file', platform).map(tag => { |
|
135 | + | return Object.assign({}, tag.attrib, { |
|
136 | + | target: tag.attrib.target, |
|
137 | + | parent: tag.attrib.parent, |
|
138 | + | after: tag.attrib.after, |
|
139 | + | xmls: tag.getchildren(), |
|
140 | + | // To support demuxing via versions |
|
141 | + | versions: tag.attrib.versions, |
|
142 | + | deviceTarget: tag.attrib['device-target'] |
|
143 | + | }); |
|
144 | + | }); |
|
134 | 145 | } |
|
135 | 146 | ||
136 | 147 | /** |
139 | 150 | * @param {string} platform |
|
140 | 151 | */ |
|
141 | 152 | getEditConfigs (platform) { |
|
142 | - | return this._getTags('edit-config', platform).map(tag => ({ |
|
143 | - | file: tag.attrib.file, |
|
144 | - | target: tag.attrib.target, |
|
145 | - | mode: tag.attrib.mode, |
|
146 | - | xmls: tag.getchildren() |
|
147 | - | })); |
|
153 | + | return this._getTags('edit-config', platform).map(tag => { |
|
154 | + | return Object.assign({}, tag.attrib, { |
|
155 | + | file: tag.attrib.file, |
|
156 | + | target: tag.attrib.target, |
|
157 | + | mode: tag.attrib.mode, |
|
158 | + | xmls: tag.getchildren() |
|
159 | + | }); |
|
160 | + | }); |
|
148 | 161 | } |
|
149 | 162 | ||
150 | 163 | /** |
169 | 182 | * @param {string} platform |
|
170 | 183 | */ |
|
171 | 184 | getSourceFiles (platform) { |
|
172 | - | return this._getTagsInPlatform('source-file', platform).map(({ attrib }) => ({ |
|
173 | - | itemType: 'source-file', |
|
174 | - | src: attrib.src, |
|
175 | - | framework: isStrTrue(attrib.framework), |
|
176 | - | weak: isStrTrue(attrib.weak), |
|
177 | - | compilerFlags: attrib['compiler-flags'], |
|
178 | - | targetDir: attrib['target-dir'] |
|
179 | - | })); |
|
185 | + | return this._getTagsInPlatform('source-file', platform).map(({ attrib }) => { |
|
186 | + | return Object.assign({}, attrib, { |
|
187 | + | itemType: 'source-file', |
|
188 | + | src: attrib.src, |
|
189 | + | framework: isStrTrue(attrib.framework), |
|
190 | + | weak: isStrTrue(attrib.weak), |
|
191 | + | compilerFlags: attrib['compiler-flags'], |
|
192 | + | targetDir: attrib['target-dir'] |
|
193 | + | }); |
|
194 | + | }); |
|
180 | 195 | } |
|
181 | 196 | ||
182 | 197 | /** |
187 | 202 | * @param {string} platform |
|
188 | 203 | */ |
|
189 | 204 | getHeaderFiles (platform) { |
|
190 | - | return this._getTagsInPlatform('header-file', platform).map(({ attrib }) => ({ |
|
191 | - | itemType: 'header-file', |
|
192 | - | src: attrib.src, |
|
193 | - | targetDir: attrib['target-dir'], |
|
194 | - | type: attrib.type |
|
195 | - | })); |
|
205 | + | return this._getTagsInPlatform('header-file', platform).map(({ attrib }) => { |
|
206 | + | return Object.assign({}, attrib, { |
|
207 | + | itemType: 'header-file', |
|
208 | + | src: attrib.src, |
|
209 | + | targetDir: attrib['target-dir'], |
|
210 | + | type: attrib.type |
|
211 | + | }); |
|
212 | + | }); |
|
196 | 213 | } |
|
197 | 214 | ||
198 | 215 | /** |
210 | 227 | * @param {string} platform |
|
211 | 228 | */ |
|
212 | 229 | getResourceFiles (platform) { |
|
213 | - | return this._getTagsInPlatform('resource-file', platform).map(({ attrib }) => ({ |
|
214 | - | itemType: 'resource-file', |
|
215 | - | src: attrib.src, |
|
216 | - | target: attrib.target, |
|
217 | - | versions: attrib.versions, |
|
218 | - | deviceTarget: attrib['device-target'], |
|
219 | - | arch: attrib.arch, |
|
220 | - | reference: attrib.reference |
|
221 | - | })); |
|
230 | + | return this._getTagsInPlatform('resource-file', platform).map(({ attrib }) => { |
|
231 | + | return Object.assign({}, attrib, { |
|
232 | + | itemType: 'resource-file', |
|
233 | + | src: attrib.src, |
|
234 | + | target: attrib.target, |
|
235 | + | versions: attrib.versions, |
|
236 | + | deviceTarget: attrib['device-target'], |
|
237 | + | arch: attrib.arch, |
|
238 | + | reference: attrib.reference |
|
239 | + | }); |
|
240 | + | }); |
|
222 | 241 | } |
|
223 | 242 | ||
224 | 243 | /** |
230 | 249 | * @param {string} platform |
|
231 | 250 | */ |
|
232 | 251 | getLibFiles (platform) { |
|
233 | - | return this._getTagsInPlatform('lib-file', platform).map(({ attrib }) => ({ |
|
234 | - | itemType: 'lib-file', |
|
235 | - | src: attrib.src, |
|
236 | - | arch: attrib.arch, |
|
237 | - | Include: attrib.Include, |
|
238 | - | versions: attrib.versions, |
|
239 | - | deviceTarget: attrib['device-target'] || attrib.target |
|
240 | - | })); |
|
252 | + | return this._getTagsInPlatform('lib-file', platform).map(({ attrib }) => { |
|
253 | + | return Object.assign({}, attrib, { |
|
254 | + | itemType: 'lib-file', |
|
255 | + | src: attrib.src, |
|
256 | + | arch: attrib.arch, |
|
257 | + | Include: attrib.Include, |
|
258 | + | versions: attrib.versions, |
|
259 | + | deviceTarget: attrib['device-target'] || attrib.target |
|
260 | + | }); |
|
261 | + | }); |
|
241 | 262 | } |
|
242 | 263 | ||
243 | 264 | /** |
303 | 324 | * @param {string} platform |
|
304 | 325 | */ |
|
305 | 326 | getJsModules (platform) { |
|
306 | - | return this._getTags('js-module', platform).map(tag => ({ |
|
307 | - | itemType: 'js-module', |
|
308 | - | name: tag.attrib.name, |
|
309 | - | src: tag.attrib.src, |
|
310 | - | clobbers: tag.findall('clobbers').map(tag => ({ target: tag.attrib.target })), |
|
311 | - | merges: tag.findall('merges').map(tag => ({ target: tag.attrib.target })), |
|
312 | - | runs: tag.findall('runs').length > 0 |
|
313 | - | })); |
|
327 | + | return this._getTags('js-module', platform).map(tag => { |
|
328 | + | return Object.assign({}, tag.attrib, { |
|
329 | + | itemType: 'js-module', |
|
330 | + | name: tag.attrib.name, |
|
331 | + | src: tag.attrib.src, |
|
332 | + | clobbers: tag.findall('clobbers').map(tag => ({ target: tag.attrib.target })), |
|
333 | + | merges: tag.findall('merges').map(tag => ({ target: tag.attrib.target })), |
|
334 | + | runs: tag.findall('runs').length > 0 |
|
335 | + | }); |
|
336 | + | }); |
|
314 | 337 | } |
|
315 | 338 | ||
316 | 339 | getEngines () { |
|
317 | - | return this._et.findall('engines/engine').map(({ attrib }) => ({ |
|
318 | - | name: attrib.name, |
|
319 | - | version: attrib.version, |
|
320 | - | platform: attrib.platform, |
|
321 | - | scriptSrc: attrib.scriptSrc |
|
322 | - | })); |
|
340 | + | return this._et.findall('engines/engine').map(({ attrib }) => { |
|
341 | + | return Object.assign({}, attrib, { |
|
342 | + | name: attrib.name, |
|
343 | + | version: attrib.version, |
|
344 | + | platform: attrib.platform, |
|
345 | + | scriptSrc: attrib.scriptSrc |
|
346 | + | }); |
|
347 | + | }); |
|
323 | 348 | } |
|
324 | 349 | ||
325 | 350 | getPlatforms () { |
|
326 | - | return this._et.findall('platform').map(n => ({ name: n.attrib.name })); |
|
351 | + | return this._et.findall('platform').map(n => { |
|
352 | + | return Object.assign({}, n.attrib, { name: n.attrib.name }); |
|
353 | + | }); |
|
327 | 354 | } |
|
328 | 355 | ||
329 | 356 | getPlatformsArray () { |
346 | 373 | // Replaces plugin variables in s if they exist |
|
347 | 374 | const expandVars = s => varExpansions.reduce((acc, fn) => fn(acc), s); |
|
348 | 375 | ||
349 | - | return this._getTags('framework', platform).map(({ attrib }) => ({ |
|
350 | - | itemType: 'framework', |
|
351 | - | type: attrib.type, |
|
352 | - | parent: attrib.parent, |
|
353 | - | custom: isStrTrue(attrib.custom), |
|
354 | - | embed: isStrTrue(attrib.embed), |
|
355 | - | src: expandVars(attrib.src), |
|
356 | - | spec: attrib.spec, |
|
357 | - | weak: isStrTrue(attrib.weak), |
|
358 | - | versions: attrib.versions, |
|
359 | - | targetDir: attrib['target-dir'], |
|
360 | - | deviceTarget: attrib['device-target'] || attrib.target, |
|
361 | - | arch: attrib.arch, |
|
362 | - | implementation: attrib.implementation |
|
363 | - | })); |
|
376 | + | return this._getTags('framework', platform).map(({ attrib }) => { |
|
377 | + | return Object.assign({}, attrib, { |
|
378 | + | itemType: 'framework', |
|
379 | + | type: attrib.type, |
|
380 | + | parent: attrib.parent, |
|
381 | + | custom: isStrTrue(attrib.custom), |
|
382 | + | embed: isStrTrue(attrib.embed), |
|
383 | + | src: expandVars(attrib.src), |
|
384 | + | spec: attrib.spec, |
|
385 | + | weak: isStrTrue(attrib.weak), |
|
386 | + | versions: attrib.versions, |
|
387 | + | targetDir: attrib['target-dir'], |
|
388 | + | deviceTarget: attrib['device-target'] || attrib.target, |
|
389 | + | arch: attrib.arch, |
|
390 | + | implementation: attrib.implementation |
|
391 | + | }); |
|
392 | + | }); |
|
364 | 393 | } |
|
365 | 394 | ||
366 | 395 | getFilesAndFrameworks (platform, options) { |
Files | Coverage |
---|---|
src | 89.77% |
cordova-common.js | 0.00% |
Project Totals (20 files) | 88.43% |