@batijs/build 0.0.287 → 0.0.288
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/dist/index.js +7 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -72,6 +72,12 @@ import { formatCode } from "@batijs/core";
|
|
|
72
72
|
var isWin = process.platform === "win32";
|
|
73
73
|
async function transformFileAfterExec(filepath, fileContent) {
|
|
74
74
|
if (fileContent === void 0 || fileContent === null) return null;
|
|
75
|
+
if (typeof fileContent == "object" && typeof fileContent.finalize === "function") {
|
|
76
|
+
fileContent = fileContent.finalize();
|
|
77
|
+
if (typeof fileContent !== "string") {
|
|
78
|
+
throw new Error("finalize() must return a string");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
75
81
|
const parsed = parse(filepath);
|
|
76
82
|
const toTest = [parsed.base, parsed.ext, parsed.name].filter(Boolean);
|
|
77
83
|
for (const ext of toTest) {
|
|
@@ -96,6 +102,7 @@ async function transformFileAfterExec(filepath, fileContent) {
|
|
|
96
102
|
case ".toml":
|
|
97
103
|
return fileContent;
|
|
98
104
|
case ".json":
|
|
105
|
+
if (typeof fileContent === "string") return fileContent;
|
|
99
106
|
return JSON.stringify(fileContent, null, 2);
|
|
100
107
|
case ".yml":
|
|
101
108
|
case ".yaml":
|
|
@@ -300,8 +307,6 @@ async function* walk(dir) {
|
|
|
300
307
|
}
|
|
301
308
|
async function main(options, meta) {
|
|
302
309
|
const sources = Array.isArray(options.source) ? options.source : [options.source];
|
|
303
|
-
const allImports = /* @__PURE__ */ new Map();
|
|
304
|
-
const filesContainingIncludeIfImported = /* @__PURE__ */ new Set();
|
|
305
310
|
function updateAllImports(target, imports, includeIfImported) {
|
|
306
311
|
const rf = new RelationFile(target, includeIfImported);
|
|
307
312
|
if (!imports) return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@batijs/build",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.288",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [],
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@types/node": "^18.19.14",
|
|
12
12
|
"tsup": "^8.3.0",
|
|
13
|
-
"@batijs/compile": "0.0.
|
|
13
|
+
"@batijs/compile": "0.0.288"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@batijs/core": "0.0.
|
|
16
|
+
"@batijs/core": "0.0.288"
|
|
17
17
|
},
|
|
18
18
|
"main": "./dist/index.js",
|
|
19
19
|
"module": "./dist/index.js",
|