@batijs/build 0.0.317 → 0.0.319

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/dist/index.js +22 -8
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -38,7 +38,17 @@ async function mergeDts({
38
38
  const res = await transformAndFormat(currentAst.generate().code, meta, {
39
39
  filepath
40
40
  });
41
- return res.code;
41
+ return clearExports(res.code, meta);
42
+ }
43
+ function clearExports(code, meta) {
44
+ if (code.trim() === "export {};") {
45
+ return void 0;
46
+ }
47
+ if (meta.BATI.has("biome")) {
48
+ const index = code.indexOf("\nexport {};");
49
+ return code.slice(0, index) + "\n// biome-ignore lint/complexity/noUselessEmptyExport: ensure that the file is considered as a module" + code.slice(index);
50
+ }
51
+ return code;
42
52
  }
43
53
 
44
54
  // src/operations/file.ts
@@ -52,13 +62,17 @@ async function executeOperationFile(op, {
52
62
  filepath
53
63
  });
54
64
  let fileContent = result.code;
55
- if (op.sourceAbsolute.endsWith(".d.ts") && previousOperationSameDestination?.content) {
56
- fileContent = await mergeDts({
57
- fileContent,
58
- previousContent: previousOperationSameDestination.content,
59
- meta,
60
- filepath
61
- });
65
+ if (op.sourceAbsolute.endsWith(".d.ts")) {
66
+ if (previousOperationSameDestination?.content) {
67
+ fileContent = await mergeDts({
68
+ fileContent,
69
+ previousContent: previousOperationSameDestination.content,
70
+ meta,
71
+ filepath
72
+ });
73
+ } else {
74
+ fileContent = clearExports(fileContent, meta);
75
+ }
62
76
  }
63
77
  return {
64
78
  context: result.context,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@batijs/build",
3
- "version": "0.0.317",
3
+ "version": "0.0.319",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -10,11 +10,11 @@
10
10
  "devDependencies": {
11
11
  "@types/node": "^18.19.68",
12
12
  "tsup": "^8.3.5",
13
- "@batijs/compile": "0.0.317",
14
- "@batijs/features": "0.0.317"
13
+ "@batijs/compile": "0.0.319",
14
+ "@batijs/features": "0.0.319"
15
15
  },
16
16
  "dependencies": {
17
- "@batijs/core": "0.0.317"
17
+ "@batijs/core": "0.0.319"
18
18
  },
19
19
  "main": "./dist/index.js",
20
20
  "module": "./dist/index.js",