bimba-cli 0.2.3 → 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 (2) hide show
  1. package/package.json +4 -1
  2. package/plugin.js +40 -40
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "bimba-cli",
3
- "version": "0.2.3",
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 }) => {