bimba-cli 0.2.2 → 0.2.4

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 +7 -1
  2. package/package.json +4 -1
  3. package/plugin.js +40 -40
package/index.js CHANGED
@@ -64,6 +64,7 @@ if(!entrypoint || !flags.outdir) {
64
64
  }
65
65
 
66
66
  // build
67
+ let bundling = false;
67
68
  bundle();
68
69
  watch(bundle);
69
70
 
@@ -83,6 +84,9 @@ function watch(callback) {
83
84
  }
84
85
 
85
86
  async function bundle() {
87
+ if (bundling) return;
88
+ bundling = true;
89
+
86
90
  if (!fs.existsSync(entrypoint)) {
87
91
  console.log(theme.failure('Error.') + ` The specified entrypoint does not exist: ${theme.filedir(entrypoint)}`);
88
92
  process.exit(0);
@@ -106,7 +110,7 @@ async function bundle() {
106
110
  minify: flags.minify || true,
107
111
  plugins: [imbaPlugin]
108
112
  });
109
-
113
+
110
114
  if(stats.failed)
111
115
  console.log(theme.start(theme.failure("Failure.") +` Imba compiler failed to proceed ${theme.count(stats.failed)} file${stats.failed > 1 ? 's' : ''}`));
112
116
  else
@@ -117,4 +121,6 @@ async function bundle() {
117
121
  console.log(log);
118
122
  }
119
123
  }
124
+
125
+ bundling = false;
120
126
  }
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "bimba-cli",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "repository": "github:HeapVoid/bimba",
5
5
  "module": "index.js",
6
6
  "bin": {
7
7
  "bimba": "./index.js"
8
8
  },
9
+ "scripts": {
10
+ "upload": "npm publish"
11
+ },
9
12
  "description": "The CLI tool to run Imba projects under Bun",
10
13
  "keywords": ["imba", "bun", "plugin"],
11
14
  "license": "MIT",
package/plugin.js CHANGED
@@ -22,49 +22,49 @@ export const imbaPlugin = {
22
22
  name: "imba",
23
23
  async setup(build) {
24
24
 
25
- // when there is import without file extension
26
- build.onResolve({filter: /^.*[^.]{5}$/ }, ({ path, importer }) => {
25
+ // // when there is import without file extension
26
+ // build.onResolve({filter: /^.*[^.]{5}$/ }, ({ path, importer }) => {
27
27
 
28
- let filename = path;
29
- // resolve relative path
30
- if (path.startsWith('.')) { filename = dir.resolve(dir.dirname(importer), filename) };
31
-
32
- // assume that the file is .js
33
- try { return {path: Bun.resolveSync(filename + '.js', '.')}}
34
- catch (error) {
35
- // assume that the file is .mjs
36
- try { return {path: Bun.resolveSync(filename + '.mjs', '.')}}
37
- catch (error) {
38
- // assume that the file is .cs
39
- try { return {path: Bun.resolveSync(filename + '.cjs', '.')}}
40
- catch (error) {
41
- // assume that the file is .imba
42
- try { return {path: Bun.resolveSync(filename + '.imba', '.')}}
43
- catch (error) {
44
- // if direct resolution failed
45
- filename += '.imba';
28
+ // let filename = path;
29
+ // // resolve relative path
30
+ // if (path.startsWith('.')) { filename = dir.resolve(dir.dirname(importer), filename) };
31
+
32
+ // // assume that the file is .js
33
+ // try { return {path: Bun.resolveSync(filename + '.js', '.')}}
34
+ // catch (error) {
35
+ // // assume that the file is .mjs
36
+ // try { return {path: Bun.resolveSync(filename + '.mjs', '.')}}
37
+ // catch (error) {
38
+ // // assume that the file is .cs
39
+ // try { return {path: Bun.resolveSync(filename + '.cjs', '.')}}
40
+ // catch (error) {
41
+ // // assume that the file is .imba
42
+ // try { return {path: Bun.resolveSync(filename + '.imba', '.')}}
43
+ // catch (error) {
44
+ // // if direct resolution failed
45
+ // filename += '.imba';
46
46
 
47
- // assume that the relative path should be resolved relative to importer
48
- let fn = dir.resolve(dir.dirname(importer), filename);
49
- if (fs.existsSync(fn)) return {path: fn};
50
- // assume that the relative path should be resolved relative to node_modules
51
- fn = dir.resolve('./node_modules', filename);
52
- if (fs.existsSync(fn)) return {path: fn};
53
- // assume that the relative path should be resolved relative to project root
54
- fn = dir.resolve(process.cwd(), filename);
55
- if (fs.existsSync(fn)) return {path: fn};
47
+ // // assume that the relative path should be resolved relative to importer
48
+ // let fn = dir.resolve(dir.dirname(importer), filename);
49
+ // if (fs.existsSync(fn)) return {path: fn};
50
+ // // assume that the relative path should be resolved relative to node_modules
51
+ // fn = dir.resolve('./node_modules', filename);
52
+ // if (fs.existsSync(fn)) return {path: fn};
53
+ // // assume that the relative path should be resolved relative to project root
54
+ // fn = dir.resolve(process.cwd(), filename);
55
+ // if (fs.existsSync(fn)) return {path: fn};
56
56
 
57
- // if the path still is unresolved throw error and leave the further resolution on Bun's resolver
58
- if (error instanceof Error) {
59
- throw new Error(error.message);
60
- }
61
- else
62
- throw new Error('Could not resolve file: ' + path);
63
- }
64
- }
65
- }
66
- }
67
- })
57
+ // // if the path still is unresolved throw error and leave the further resolution on Bun's resolver
58
+ // if (error instanceof Error) {
59
+ // throw new Error(error.message);
60
+ // }
61
+ // else
62
+ // throw new Error('Could not resolve file: ' + path);
63
+ // }
64
+ // }
65
+ // }
66
+ // }
67
+ // })
68
68
 
69
69
  // when an .imba file is imported...
70
70
  build.onLoad({ filter: /\.imba$/ }, async ({ path }) => {