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.
Files changed (3) hide show
  1. package/index.js +3 -2
  2. package/package.json +1 -1
  3. 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(theme.start(theme.failure("Failure.") +` Unknown error. Chech the syntax.`));
127
+ catch(error) {
128
+ console.log('')
129
+ console.log(error)
129
130
  }
130
131
  finally {
131
132
  bundling = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bimba-cli",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/HeapVoid/bimba.git"
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
- sourcePath: path,
51
- platform: 'browser'
51
+ sourcePath: path,
52
+ platform: 'browser'
52
53
  })
53
54
 
54
55
  // the file has been successfully compiled
55
- if (!out.errors || !out.errors.length) {
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++;