@polylith/builder 0.1.11 → 0.1.13
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/App.js +24 -9
- package/ConfigApp.js +1 -1
- package/ConfigFeature.js +1 -0
- package/package.json +3 -1
package/App.js
CHANGED
|
@@ -6,7 +6,9 @@ import { babel } from '@rollup/plugin-babel';
|
|
|
6
6
|
import * as resolve from '@rollup/plugin-node-resolve';
|
|
7
7
|
import commonjs from '@rollup/plugin-commonjs';
|
|
8
8
|
import rollupJson from "@rollup/plugin-json"
|
|
9
|
+
import url from '@rollup/plugin-url'
|
|
9
10
|
|
|
11
|
+
import svgr from '@svgr/rollup'
|
|
10
12
|
import html from 'rollup-plugin-html';
|
|
11
13
|
import livereload from 'rollup-plugin-livereload';
|
|
12
14
|
import styles from "rollup-plugin-styles";
|
|
@@ -218,12 +220,20 @@ export default class App {
|
|
|
218
220
|
|
|
219
221
|
/**
|
|
220
222
|
* Call this method to add specifications for application css files These
|
|
221
|
-
* css files will be included in the html template
|
|
223
|
+
* css files will be included in the html template. They will also be copied
|
|
224
|
+
* to the destination folder
|
|
222
225
|
*
|
|
226
|
+
* @param {String} root the relative path from the source root to the path
|
|
227
|
+
* to the origin of the caller. This will either be a feature root, or
|
|
228
|
+
* empty for the main application the source pathPaths specified in the
|
|
229
|
+
* resource spec are assumed to be relative to this.
|
|
223
230
|
* @param {ResourceSpecList} specs the specification for the css files. These
|
|
224
231
|
* will also be added as resources to be copied.
|
|
225
232
|
*/
|
|
226
|
-
addMainCss(specs) {
|
|
233
|
+
addMainCss(root, specs) {
|
|
234
|
+
specs = specs.map(function(spec) {
|
|
235
|
+
return {root, spec}
|
|
236
|
+
}, this)
|
|
227
237
|
this.cssSpecs = [...this.cssSpecs, ...specs];
|
|
228
238
|
}
|
|
229
239
|
|
|
@@ -233,9 +243,10 @@ export default class App {
|
|
|
233
243
|
async findMainCss() {
|
|
234
244
|
var files = new Files(this.sourcePath, this.destPath)
|
|
235
245
|
|
|
236
|
-
// Find all the files
|
|
246
|
+
// Find all the files from the added css specs. Also add them to be copied
|
|
237
247
|
this.cssSpecs.forEach(function(spec) {
|
|
238
|
-
files.addResourceSpec(
|
|
248
|
+
files.addResourceSpec(spec.root, spec.spec);
|
|
249
|
+
this.files.addResourceSpec(spec.root, spec.spec);
|
|
239
250
|
}, this)
|
|
240
251
|
|
|
241
252
|
var expanded = await files.findAllFiles();
|
|
@@ -245,8 +256,10 @@ export default class App {
|
|
|
245
256
|
this.cssFiles.push(file.uri)
|
|
246
257
|
}, this);
|
|
247
258
|
|
|
248
|
-
|
|
249
|
-
|
|
259
|
+
this.cssSpecs.map(function(spec) {
|
|
260
|
+
this.files.addResourceSpec(spec.root, spec.spec);
|
|
261
|
+
return spec.spec;
|
|
262
|
+
}, this);
|
|
250
263
|
}
|
|
251
264
|
|
|
252
265
|
/**
|
|
@@ -255,9 +268,9 @@ export default class App {
|
|
|
255
268
|
*
|
|
256
269
|
* @param {String} root the relative path from the source root to the path
|
|
257
270
|
* to the origin of the caller. This will either be a feature root, or
|
|
258
|
-
* empty for the main
|
|
259
|
-
* resource spec are assumed to be relative to this
|
|
260
|
-
* @param {
|
|
271
|
+
* empty for the main application the source pathPaths specified in the
|
|
272
|
+
* resource spec are assumed to be relative to this.
|
|
273
|
+
* @param {ResourceSpecList} resourceSpecs the copy specs
|
|
261
274
|
* for all the resources being added.
|
|
262
275
|
*/
|
|
263
276
|
addResources(root, resourceSpecs) {
|
|
@@ -555,6 +568,8 @@ export default class App {
|
|
|
555
568
|
presets: ['@babel/preset-react'],
|
|
556
569
|
babelHelpers: 'bundled',
|
|
557
570
|
}),
|
|
571
|
+
url(),
|
|
572
|
+
svgr(),
|
|
558
573
|
loadConfigs(this.configs),
|
|
559
574
|
loader(this.loadables),
|
|
560
575
|
features(this.featureIndexes),
|
package/ConfigApp.js
CHANGED
|
@@ -34,7 +34,7 @@ export default class ConfigApp extends App {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
if (config.resources && Array.isArray(config.resources)) this.addResources('', config.resources);
|
|
37
|
-
if (config.css) this.addMainCss(config.css);
|
|
37
|
+
if (config.css) this.addMainCss('', config.css);
|
|
38
38
|
|
|
39
39
|
if (config.variables) {
|
|
40
40
|
var names = Object.keys(config.variables);
|
package/ConfigFeature.js
CHANGED
|
@@ -33,5 +33,6 @@ export default class ConfigFeature extends Feature {
|
|
|
33
33
|
if (config.index) app.addFeatureIndex(path.join(this.root, config.index));
|
|
34
34
|
if (config.config) app.addConfig(config.config, this.root);
|
|
35
35
|
if (config.resources && Array.isArray(config.resources)) app.addResources(this.root, config.resources);
|
|
36
|
+
if (config.css && Array.isArray(config.css)) app.addMainCss(this.root, config.css);
|
|
36
37
|
}
|
|
37
38
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polylith/builder",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "The polylith builder",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"@rollup/plugin-commonjs": "^21.0.0",
|
|
17
17
|
"@rollup/plugin-json": "^5.0.2",
|
|
18
18
|
"@rollup/plugin-node-resolve": "^13.0.5",
|
|
19
|
+
"@rollup/plugin-url": "^8.0.1",
|
|
20
|
+
"@svgr/rollup": "^6.5.1",
|
|
19
21
|
"babel": "^6.23.0",
|
|
20
22
|
"escape-string-regexp": "^5.0.0",
|
|
21
23
|
"fast-glob": "^3.2.12",
|