@polylith/builder 0.1.9 → 0.1.12
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 +27 -10
- package/ConfigApp.js +1 -1
- package/ConfigFeature.js +1 -0
- package/package.json +3 -1
package/App.js
CHANGED
|
@@ -10,6 +10,8 @@ import rollupJson from "@rollup/plugin-json"
|
|
|
10
10
|
import html from 'rollup-plugin-html';
|
|
11
11
|
import livereload from 'rollup-plugin-livereload';
|
|
12
12
|
import styles from "rollup-plugin-styles";
|
|
13
|
+
import builtins from 'rollup-plugin-node-builtins';
|
|
14
|
+
import globals from 'rollup-plugin-node-globals';
|
|
13
15
|
|
|
14
16
|
import loader from './plugin-loader.js';
|
|
15
17
|
import mainHTML from './plugin-main-html.js';
|
|
@@ -216,12 +218,20 @@ export default class App {
|
|
|
216
218
|
|
|
217
219
|
/**
|
|
218
220
|
* Call this method to add specifications for application css files These
|
|
219
|
-
* css files will be included in the html template
|
|
221
|
+
* css files will be included in the html template. They will also be copied
|
|
222
|
+
* to the destination folder
|
|
220
223
|
*
|
|
224
|
+
* @param {String} root the relative path from the source root to the path
|
|
225
|
+
* to the origin of the caller. This will either be a feature root, or
|
|
226
|
+
* empty for the main application the source pathPaths specified in the
|
|
227
|
+
* resource spec are assumed to be relative to this.
|
|
221
228
|
* @param {ResourceSpecList} specs the specification for the css files. These
|
|
222
229
|
* will also be added as resources to be copied.
|
|
223
230
|
*/
|
|
224
|
-
addMainCss(specs) {
|
|
231
|
+
addMainCss(root, specs) {
|
|
232
|
+
specs = specs.map(function(spec) {
|
|
233
|
+
return {root, spec}
|
|
234
|
+
}, this)
|
|
225
235
|
this.cssSpecs = [...this.cssSpecs, ...specs];
|
|
226
236
|
}
|
|
227
237
|
|
|
@@ -231,9 +241,10 @@ export default class App {
|
|
|
231
241
|
async findMainCss() {
|
|
232
242
|
var files = new Files(this.sourcePath, this.destPath)
|
|
233
243
|
|
|
234
|
-
// Find all the files
|
|
244
|
+
// Find all the files from the added css specs. Also add them to be copied
|
|
235
245
|
this.cssSpecs.forEach(function(spec) {
|
|
236
|
-
files.addResourceSpec(
|
|
246
|
+
files.addResourceSpec(spec.root, spec.spec);
|
|
247
|
+
this.files.addResourceSpec(spec.root, spec.spec);
|
|
237
248
|
}, this)
|
|
238
249
|
|
|
239
250
|
var expanded = await files.findAllFiles();
|
|
@@ -243,8 +254,10 @@ export default class App {
|
|
|
243
254
|
this.cssFiles.push(file.uri)
|
|
244
255
|
}, this);
|
|
245
256
|
|
|
246
|
-
|
|
247
|
-
|
|
257
|
+
this.cssSpecs.map(function(spec) {
|
|
258
|
+
this.files.addResourceSpec(spec.root, spec.spec);
|
|
259
|
+
return spec.spec;
|
|
260
|
+
}, this);
|
|
248
261
|
}
|
|
249
262
|
|
|
250
263
|
/**
|
|
@@ -253,9 +266,9 @@ export default class App {
|
|
|
253
266
|
*
|
|
254
267
|
* @param {String} root the relative path from the source root to the path
|
|
255
268
|
* to the origin of the caller. This will either be a feature root, or
|
|
256
|
-
* empty for the main
|
|
257
|
-
* resource spec are assumed to be relative to this
|
|
258
|
-
* @param {
|
|
269
|
+
* empty for the main application the source pathPaths specified in the
|
|
270
|
+
* resource spec are assumed to be relative to this.
|
|
271
|
+
* @param {ResourceSpecList} resourceSpecs the copy specs
|
|
259
272
|
* for all the resources being added.
|
|
260
273
|
*/
|
|
261
274
|
addResources(root, resourceSpecs) {
|
|
@@ -539,12 +552,16 @@ export default class App {
|
|
|
539
552
|
this.templateVariables['codeVariables'] = codeVariables;
|
|
540
553
|
|
|
541
554
|
var plugins = [
|
|
542
|
-
jsconfig(this.root),
|
|
543
555
|
resolve.nodeResolve({
|
|
556
|
+
preferBuiltins: true,
|
|
557
|
+
browser: true,
|
|
544
558
|
extensions: ['.js', '.jsx']
|
|
545
559
|
}),
|
|
546
560
|
commonjs(),
|
|
561
|
+
globals(),
|
|
562
|
+
builtins(),
|
|
547
563
|
rollupJson(),
|
|
564
|
+
jsconfig(this.root),
|
|
548
565
|
babel({
|
|
549
566
|
presets: ['@babel/preset-react'],
|
|
550
567
|
babelHelpers: 'bundled',
|
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.12",
|
|
4
4
|
"description": "The polylith builder",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
"rollup-plugin-html": "^0.2.1",
|
|
26
26
|
"rollup-plugin-jsx": "^1.0.3",
|
|
27
27
|
"rollup-plugin-livereload": "^2.0.5",
|
|
28
|
+
"rollup-plugin-node-builtins": "^2.1.2",
|
|
29
|
+
"rollup-plugin-node-globals": "^1.4.0",
|
|
28
30
|
"rollup-plugin-styles": "^4.0.0",
|
|
29
31
|
"sass": "^1.43.4"
|
|
30
32
|
}
|