@polylith/builder 0.0.36 → 0.0.37
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 +1 -1
- package/Files.js +4 -0
- package/package.json +1 -1
- package/plugin-copy-resources.js +10 -1
- package/plugin-jsconfig.js +0 -5
- package/plugin-loader.js +0 -3
package/App.js
CHANGED
package/Files.js
CHANGED
|
@@ -142,12 +142,16 @@ export default class Files {
|
|
|
142
142
|
* stored in the object variable this.files
|
|
143
143
|
*/
|
|
144
144
|
async findAllFiles() {
|
|
145
|
+
if (this.filesFound) return this.files;
|
|
146
|
+
|
|
145
147
|
// using a for loop here because we are making async calls
|
|
146
148
|
for (let idx = 0; idx < this.specs.length; idx++) {
|
|
147
149
|
let spec = this.specs[idx];
|
|
148
150
|
await this.findFiles(spec);
|
|
149
151
|
}
|
|
150
152
|
|
|
153
|
+
this.filesFound = true;
|
|
154
|
+
|
|
151
155
|
return this.files;
|
|
152
156
|
}
|
|
153
157
|
|
package/package.json
CHANGED
package/plugin-copy-resources.js
CHANGED
|
@@ -8,7 +8,16 @@ var copied= {}
|
|
|
8
8
|
*/
|
|
9
9
|
export default function(name, files) {
|
|
10
10
|
return {
|
|
11
|
-
name: "
|
|
11
|
+
name: "copy-resources",
|
|
12
|
+
|
|
13
|
+
async buildStart(){
|
|
14
|
+
var foundFiles = files.findAllFiles();
|
|
15
|
+
var filenames = Object.keys(foundFiles);
|
|
16
|
+
filenames.forEach(function(name) {
|
|
17
|
+
var destFilename = foundFiles[name].destFilename;
|
|
18
|
+
this.addWatchFile(destFilename);
|
|
19
|
+
});
|
|
20
|
+
},
|
|
12
21
|
|
|
13
22
|
async generateBundle(outputOptions, bundleInfo) {
|
|
14
23
|
// assets are not watched, never copy more than once
|
package/plugin-jsconfig.js
CHANGED
|
@@ -63,7 +63,6 @@ async function findPathMatch(base, source, paths) {
|
|
|
63
63
|
if (source.indexOf(base) === 0) return
|
|
64
64
|
// source = source.slice(base.length);
|
|
65
65
|
|
|
66
|
-
console.log('>>>', source)
|
|
67
66
|
for(let patternIdx = 0; patternIdx < patterns.length; patternIdx++) {
|
|
68
67
|
let pattern = patterns[patternIdx];
|
|
69
68
|
let searches = paths[pattern];
|
|
@@ -73,7 +72,6 @@ async function findPathMatch(base, source, paths) {
|
|
|
73
72
|
if (!Array.isArray(searches)) continue;
|
|
74
73
|
for (let searchIdx = 0; searchIdx < searches.length; searchIdx++) {
|
|
75
74
|
var tryName = path.join(base, searches[searchIdx].replace('*', capture));
|
|
76
|
-
console.log('\t..', searches[searchIdx], tryName);
|
|
77
75
|
|
|
78
76
|
if (await fileExists(tryName)) {
|
|
79
77
|
return tryName;
|
|
@@ -89,7 +87,6 @@ export default function jsconfig(root) {
|
|
|
89
87
|
var paths;
|
|
90
88
|
var previouslyMatched = {};
|
|
91
89
|
|
|
92
|
-
console.log('====root', root);
|
|
93
90
|
async function readJsConfig() {
|
|
94
91
|
var jsConfigPath = path.join(root, 'jsconfig.json');
|
|
95
92
|
var exists = await fileExists(jsConfigPath);
|
|
@@ -116,7 +113,6 @@ export default function jsconfig(root) {
|
|
|
116
113
|
async resolveId (source, importer, options) {
|
|
117
114
|
source = fixPath(source);
|
|
118
115
|
|
|
119
|
-
// console.log('---', source);
|
|
120
116
|
if (previouslyMatched[source] !== undefined) return previouslyMatched[source];
|
|
121
117
|
previouslyMatched[source] === null;
|
|
122
118
|
|
|
@@ -125,7 +121,6 @@ export default function jsconfig(root) {
|
|
|
125
121
|
|
|
126
122
|
if (basePath) {
|
|
127
123
|
var tryName = path.join(root, basePath, source);
|
|
128
|
-
console.log('trying', tryName)
|
|
129
124
|
if (await fileExists(tryName)) {
|
|
130
125
|
previouslyMatched[source] = tryName;
|
|
131
126
|
return tryName;
|
package/plugin-loader.js
CHANGED
|
@@ -48,8 +48,6 @@ ${serviceStr}
|
|
|
48
48
|
var source = source.replace('{{SWITCHES}}', loadableSwitches);
|
|
49
49
|
var source = source.replace(/\t/g, ' ');
|
|
50
50
|
|
|
51
|
-
console.log(source);
|
|
52
|
-
|
|
53
51
|
return source;
|
|
54
52
|
}
|
|
55
53
|
|
|
@@ -69,7 +67,6 @@ export default function loader(loadables) {
|
|
|
69
67
|
var root = path.dirname(fixPath(import.meta.url));
|
|
70
68
|
if (!templateSource) {
|
|
71
69
|
templateSource = await readFile(path.join(root, 'loaderTemplate.txt'), 'utf-8');
|
|
72
|
-
console.log(templateSource);
|
|
73
70
|
}
|
|
74
71
|
|
|
75
72
|
if (id === '@polylith/loader') {
|