@polylith/builder 0.2.22 → 0.2.24
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 +14 -13
- package/ConfigApp.js +14 -5
- package/Files.js +1 -0
- package/package.json +5 -4
package/App.js
CHANGED
|
@@ -564,7 +564,7 @@ export default class App {
|
|
|
564
564
|
*/
|
|
565
565
|
async findLoadableCss(loadable) {
|
|
566
566
|
if (loadable.css) {
|
|
567
|
-
var files = new Files(this.sourcePath, this.destPath)
|
|
567
|
+
var files = new Files(this.sourcePath, this.destPath, this.testPath)
|
|
568
568
|
loadable.css.forEach(function(spec) {
|
|
569
569
|
files.addResourceSpec(loadable.root, spec);
|
|
570
570
|
}, this)
|
|
@@ -701,6 +701,7 @@ export default class App {
|
|
|
701
701
|
var manualChunks = this.getManualChunks();
|
|
702
702
|
var mainCss = await this.buildMainCss();
|
|
703
703
|
var codeVariables = this.getCodeVariablesValue();
|
|
704
|
+
var sourceMap = !this.polylithConfig.minify;
|
|
704
705
|
|
|
705
706
|
this.templateVariables['mainCss'] = mainCss;
|
|
706
707
|
this.templateVariables['codeVariables'] = codeVariables;
|
|
@@ -766,7 +767,7 @@ export default class App {
|
|
|
766
767
|
},
|
|
767
768
|
output : {
|
|
768
769
|
output : {
|
|
769
|
-
sourcemap:
|
|
770
|
+
sourcemap: sourceMap,
|
|
770
771
|
dir : this.destPath,
|
|
771
772
|
format: 'es',
|
|
772
773
|
assetFileNames: function(chunkInfo) {
|
|
@@ -813,11 +814,11 @@ export default class App {
|
|
|
813
814
|
}
|
|
814
815
|
|
|
815
816
|
await this.testFeatures();
|
|
816
|
-
this.
|
|
817
|
+
this.spec = await this.generateTestConfiguration();
|
|
817
818
|
|
|
818
|
-
const bundle = await rollup.rollup(this.
|
|
819
|
-
await bundle.generate(this.
|
|
820
|
-
await bundle.write(this.
|
|
819
|
+
const bundle = await rollup.rollup(this.spec.input);
|
|
820
|
+
await bundle.generate(this.spec.output);
|
|
821
|
+
await bundle.write(this.spec.output);
|
|
821
822
|
await bundle.close();
|
|
822
823
|
|
|
823
824
|
return true;
|
|
@@ -831,11 +832,11 @@ export default class App {
|
|
|
831
832
|
async build() {
|
|
832
833
|
this.testing = false;
|
|
833
834
|
await this.buildFeatures();
|
|
834
|
-
this.
|
|
835
|
+
this.spec = await this.generateBuildConfiguration();
|
|
835
836
|
|
|
836
|
-
const bundle = await rollup.rollup(this.
|
|
837
|
-
await bundle.generate(this.
|
|
838
|
-
await bundle.write(this.
|
|
837
|
+
const bundle = await rollup.rollup(this.spec.input);
|
|
838
|
+
await bundle.generate(this.spec.output);
|
|
839
|
+
await bundle.write(this.spec.output);
|
|
839
840
|
await bundle.close();
|
|
840
841
|
|
|
841
842
|
return true;
|
|
@@ -847,9 +848,9 @@ export default class App {
|
|
|
847
848
|
*/
|
|
848
849
|
watch() {
|
|
849
850
|
var watchConfig = {
|
|
850
|
-
...this.
|
|
851
|
-
output: [this.
|
|
852
|
-
...this.
|
|
851
|
+
...this.spec.input,
|
|
852
|
+
output: [this.spec.output.output],
|
|
853
|
+
...this.spec.watch,
|
|
853
854
|
}
|
|
854
855
|
|
|
855
856
|
const watcher = rollup.watch(watchConfig);
|
package/ConfigApp.js
CHANGED
|
@@ -6,7 +6,13 @@ import {forceToPosix} from './utils.js'
|
|
|
6
6
|
* This class is used to build an application from a configuration file.
|
|
7
7
|
*/
|
|
8
8
|
export default class ConfigApp extends App {
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param {*} config
|
|
12
|
+
* @param {*} options
|
|
13
|
+
* @param {*} root
|
|
14
|
+
*/
|
|
15
|
+
constructor (options, config, root) {
|
|
10
16
|
root = forceToPosix(root);
|
|
11
17
|
var name = config.name || 'unnamed';
|
|
12
18
|
var index = config.index || 'src/index.js';
|
|
@@ -14,8 +20,7 @@ export default class ConfigApp extends App {
|
|
|
14
20
|
var spec = config.spec;
|
|
15
21
|
var testDest = config.testDest;
|
|
16
22
|
|
|
17
|
-
super(name, {root, index, dest, spec, testDest});
|
|
18
|
-
this.config = config;
|
|
23
|
+
super(name, options, {root, index, dest, spec, testDest});
|
|
19
24
|
|
|
20
25
|
if (!config.template || !config.template.source) throw new Error('html source not defined in config file');
|
|
21
26
|
var source = config.template.source;
|
|
@@ -29,8 +34,8 @@ export default class ConfigApp extends App {
|
|
|
29
34
|
}, this)
|
|
30
35
|
}
|
|
31
36
|
|
|
32
|
-
if (
|
|
33
|
-
|
|
37
|
+
if (config.features) {
|
|
38
|
+
config.features.forEach(function(feature) {
|
|
34
39
|
this.addFeature(feature);
|
|
35
40
|
}.bind(this))
|
|
36
41
|
}
|
|
@@ -53,5 +58,9 @@ export default class ConfigApp extends App {
|
|
|
53
58
|
if (config.router) {
|
|
54
59
|
this.setRouterModule(config.router);
|
|
55
60
|
}
|
|
61
|
+
|
|
62
|
+
if (config.liveReload) {
|
|
63
|
+
this.setLiveReloadOptions(config.liveReload);
|
|
64
|
+
}
|
|
56
65
|
}
|
|
57
66
|
}
|
package/Files.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polylith/builder",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.24",
|
|
4
4
|
"description": "The polylith builder",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -17,19 +17,20 @@
|
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/preset-env": "^7.16.11",
|
|
20
|
-
"@babel/preset-react": "^7.
|
|
20
|
+
"@babel/preset-react": "^7.22.5",
|
|
21
21
|
"@ondohers/console-colors": "^0.1.1",
|
|
22
22
|
"@polylith/config-store": "0.1.2",
|
|
23
23
|
"@polylith/core": "^0.1.9",
|
|
24
24
|
"@rollup/plugin-babel": "^5.3.0",
|
|
25
25
|
"@rollup/plugin-commonjs": "^24.0.0",
|
|
26
26
|
"@rollup/plugin-json": "^5.0.2",
|
|
27
|
-
"@rollup/plugin-node-resolve": "^13.0
|
|
27
|
+
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
28
28
|
"@svgr/rollup": "^6.5.1",
|
|
29
29
|
"babel": "^6.23.0",
|
|
30
30
|
"escape-string-regexp": "^5.0.0",
|
|
31
|
+
"express": "^4.18.2",
|
|
31
32
|
"fast-glob": "^3.2.12",
|
|
32
|
-
"fs-extra": "^10.
|
|
33
|
+
"fs-extra": "^10.1.0",
|
|
33
34
|
"less": "^4.1.2",
|
|
34
35
|
"node-console-colors": "^1.1.5",
|
|
35
36
|
"rollup": "^2.58.0",
|