bimba-cli 0.2.5 → 0.2.6
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/index.js +3 -2
- package/package.json +1 -1
- package/plugin.js +7 -6
package/index.js
CHANGED
|
@@ -124,8 +124,9 @@ async function bundle() {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
catch {
|
|
128
|
-
console.log(
|
|
127
|
+
catch(error) {
|
|
128
|
+
console.log('')
|
|
129
|
+
console.log(error)
|
|
129
130
|
}
|
|
130
131
|
finally {
|
|
131
132
|
bundling = false;
|
package/package.json
CHANGED
package/plugin.js
CHANGED
|
@@ -15,7 +15,7 @@ export let stats = {
|
|
|
15
15
|
compiled: 0,
|
|
16
16
|
cached: 0,
|
|
17
17
|
bundled: 0,
|
|
18
|
-
errors: 0
|
|
18
|
+
errors: 0,
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export const imbaPlugin = {
|
|
@@ -24,16 +24,17 @@ export const imbaPlugin = {
|
|
|
24
24
|
|
|
25
25
|
// when an .imba file is imported...
|
|
26
26
|
build.onLoad({ filter: /\.imba$/ }, async ({ path }) => {
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
const f = dir.parse(path)
|
|
29
29
|
let contents = '';
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
// return the cached version if exists
|
|
32
32
|
const cached = cache + Bun.hash(path) + '_' + fs.statSync(path).mtimeMs + '.js';
|
|
33
33
|
if (fs.existsSync(cached)) {
|
|
34
34
|
stats.bundled++;
|
|
35
35
|
stats.cached++;
|
|
36
36
|
//console.log(theme.action("cached: ") + theme.folder(f.dir + '/') + theme.filename(f.base) + " - " + theme.success("ok"));
|
|
37
|
+
//console.log(theme.action("compiling: ") + theme.folder(dir.join(f.dir,'/')) + theme.filename(f.base) + " - " + theme.success("from cache"));
|
|
37
38
|
return {
|
|
38
39
|
contents: await Bun.file(cached).text(),
|
|
39
40
|
loader: "js",
|
|
@@ -47,12 +48,12 @@ export const imbaPlugin = {
|
|
|
47
48
|
// if no cached version read and compile it with the imba compiler
|
|
48
49
|
const file = await Bun.file(path).text();
|
|
49
50
|
const out = compiler.compile(file, {
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
sourcePath: path,
|
|
52
|
+
platform: 'browser'
|
|
52
53
|
})
|
|
53
54
|
|
|
54
55
|
// the file has been successfully compiled
|
|
55
|
-
if (!out.errors
|
|
56
|
+
if (!out.errors?.length) {
|
|
56
57
|
console.log(theme.action("compiling: ") + theme.folder(dir.join(f.dir,'/')) + theme.filename(f.base) + " - " + theme.success("cached"));
|
|
57
58
|
stats.bundled++;
|
|
58
59
|
stats.compiled++;
|