@polylith/builder 0.0.22 → 0.0.23

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 CHANGED
@@ -10,8 +10,10 @@ import html from "rollup-plugin-html";
10
10
  import loader from './plugin-loader.js';
11
11
  import mainHTML from './plugin-main-html.js';
12
12
  import features from './plugin-features.js';
13
+ import config from './plugin-config.js';
13
14
  import styles from "rollup-plugin-styles";
14
15
 
16
+
15
17
  /**
16
18
  * call this method to get the path from the a filename, and force the file path
17
19
  * to use posix notation and remove all drive information. This will likely
@@ -56,6 +58,8 @@ export class App {
56
58
 
57
59
  this.name = name;
58
60
  this.index = index;
61
+ this.fullIndexPath = path.posix.join(root, index);
62
+
59
63
  this.loadables = [];
60
64
  this.featureIndexes = [];
61
65
  }
@@ -73,8 +77,8 @@ export class App {
73
77
  */
74
78
  rootPath(path) {
75
79
  var idx = path.indexOf(this.sourcePath);
76
- if (idx === 0) path.splice(0, length(this.sourcePath));
77
- if (path[0] === '/') path.splice(0, 1);
80
+ if (idx === 0) path = path.slice(this.sourcePath.length);
81
+ if (path[0] === '/') path = path.slice(1);
78
82
 
79
83
  return './' + path;
80
84
  }
@@ -106,7 +110,7 @@ export class App {
106
110
  }
107
111
  }
108
112
 
109
- if (indexExists) this.featureIndexes.push(this.rootPath(indexPath));
113
+ if (indexExists) this.featureIndexes.push(indexPath);
110
114
  }
111
115
 
112
116
  async buildFeatures() {
@@ -132,7 +136,7 @@ export class App {
132
136
  }
133
137
 
134
138
  buildConfiguration() {
135
- var input = [this.index];
139
+ var input = [this.fullIndexPath];
136
140
  this.loadables.forEach(function(path) {
137
141
  input.push(path.path);
138
142
  });
@@ -155,6 +159,7 @@ export class App {
155
159
  }),
156
160
  loader(this.loadables),
157
161
  features(this.featureIndexes),
162
+ config(),
158
163
  html({
159
164
  include: path.join(this.sourcePath, "**/*.html"),
160
165
  }),
@@ -184,6 +189,8 @@ export class App {
184
189
  await this.buildFeatures();
185
190
  var config = this.buildConfiguration();
186
191
 
192
+ console.log(JSON.stringify(config, null, ' '));
193
+
187
194
  const bundle = await rollup.rollup(config.input);
188
195
  await bundle.generate(config.output);
189
196
  await bundle.write(config.output);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polylith/builder",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "The polylith builder",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/plugin-config.js CHANGED
@@ -5,18 +5,24 @@ import rollupPluginutils from ('rollup-pluginutils');
5
5
  export default function config() {
6
6
  var opts = {};
7
7
 
8
- opts.include = '**/*.cfg'
8
+ opts.include = '**/*.pl-cfg'
9
9
 
10
10
  var filter = rollupPluginutils.createFilter(opts.include, opts.exclude);
11
11
 
12
12
  return {
13
13
  name: 'config',
14
14
 
15
+ resolveId (source, _, third) {
16
+ if (filter(source)) return source
17
+
18
+ return null;
19
+ },
20
+
15
21
  async load(id) {
16
22
  if (filter(id)) {
17
23
  console.log(id);
18
- return source;
19
- }
24
+ return '';
25
+ }
20
26
  }
21
27
  };
22
28
  }
@@ -2,12 +2,11 @@ function makeSource(features) {
2
2
 
3
3
  var importStatements = '';
4
4
  features.forEach(function(feature) {
5
- importStatements += `import from '${feature}'\n`;
5
+ importStatements += `import '${feature}'\n`;
6
6
  })
7
7
 
8
8
  var source = `${importStatements}`
9
9
 
10
- console.log(source);
11
10
  return source;
12
11
  }
13
12