@batijs/build 0.0.434 → 0.0.436
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 +20 -9
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import { existsSync } from "
|
|
3
|
-
import { mkdir, opendir, rm, rmdir, writeFile } from "
|
|
4
|
-
import path from "
|
|
2
|
+
import { existsSync } from "fs";
|
|
3
|
+
import { mkdir, opendir, rm, rmdir, writeFile } from "fs/promises";
|
|
4
|
+
import path from "path";
|
|
5
5
|
import "@batijs/core";
|
|
6
6
|
|
|
7
7
|
// src/operations/file.ts
|
|
8
8
|
import { transformAndFormat as transformAndFormat2 } from "@batijs/core";
|
|
9
|
-
import { readFile } from "
|
|
10
|
-
import { relative } from "
|
|
9
|
+
import { readFile } from "fs/promises";
|
|
10
|
+
import { relative } from "path";
|
|
11
11
|
|
|
12
12
|
// src/operations/merge-dts.ts
|
|
13
13
|
import { parseModule, transformAndFormat } from "@batijs/core";
|
|
@@ -133,7 +133,8 @@ async function importTransformer(p) {
|
|
|
133
133
|
}
|
|
134
134
|
async function executeOperationTransform(op, {
|
|
135
135
|
meta,
|
|
136
|
-
previousOperationSameDestination
|
|
136
|
+
previousOperationSameDestination,
|
|
137
|
+
packageJson
|
|
137
138
|
}) {
|
|
138
139
|
const transformer = await importTransformer(op.sourceAbsolute);
|
|
139
140
|
const previousContent = previousOperationSameDestination?.content;
|
|
@@ -143,7 +144,8 @@ async function executeOperationTransform(op, {
|
|
|
143
144
|
readfile: previousContent ? () => previousContent : void 0,
|
|
144
145
|
meta,
|
|
145
146
|
source: op.source,
|
|
146
|
-
target: op.destination
|
|
147
|
+
target: op.destination,
|
|
148
|
+
packageJson
|
|
147
149
|
})
|
|
148
150
|
);
|
|
149
151
|
return {
|
|
@@ -202,7 +204,7 @@ Please report this issue to https://github.com/vikejs/bati`);
|
|
|
202
204
|
};
|
|
203
205
|
|
|
204
206
|
// src/relations.ts
|
|
205
|
-
import { extname } from "
|
|
207
|
+
import { extname } from "path";
|
|
206
208
|
var RelationFile = class _RelationFile {
|
|
207
209
|
constructor(pathAbsolute, includeIfImported) {
|
|
208
210
|
this.pathAbsolute = pathAbsolute;
|
|
@@ -367,6 +369,11 @@ Please report this issue to https://github.com/vikejs/bati`
|
|
|
367
369
|
}
|
|
368
370
|
let previousOp = void 0;
|
|
369
371
|
let previousOpContent = void 0;
|
|
372
|
+
let packageJson = {};
|
|
373
|
+
const packageJsonDistAbsolute = path.join(
|
|
374
|
+
path.isAbsolute(options.dist) ? options.dist : path.resolve(options.dist),
|
|
375
|
+
"package.json"
|
|
376
|
+
);
|
|
370
377
|
for (const op of rearranger.compute()) {
|
|
371
378
|
if (previousOp?.destination !== op.destination) {
|
|
372
379
|
previousOp = void 0;
|
|
@@ -386,11 +393,15 @@ Please report this issue to https://github.com/vikejs/bati`
|
|
|
386
393
|
} else if (op.kind === "transform") {
|
|
387
394
|
report = await executeOperationTransform(op, {
|
|
388
395
|
meta,
|
|
389
|
-
previousOperationSameDestination: previousOp
|
|
396
|
+
previousOperationSameDestination: previousOp,
|
|
397
|
+
packageJson
|
|
390
398
|
});
|
|
391
399
|
}
|
|
392
400
|
if (report.content) {
|
|
393
401
|
await safeWriteFile(op.destination, report.content.trimStart());
|
|
402
|
+
if (op.destinationAbsolute === packageJsonDistAbsolute) {
|
|
403
|
+
packageJson = JSON.parse(report.content);
|
|
404
|
+
}
|
|
394
405
|
}
|
|
395
406
|
previousOpContent = report.content ?? previousOpContent;
|
|
396
407
|
previousOp = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@batijs/build",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.436",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [],
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"repository": "https://github.com/vikejs/bati",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"devDependencies": {
|
|
11
|
-
"@types/node": "^18.19.
|
|
12
|
-
"tsup": "^8.
|
|
13
|
-
"@batijs/
|
|
14
|
-
"@batijs/
|
|
11
|
+
"@types/node": "^18.19.103",
|
|
12
|
+
"tsup": "^8.5.0",
|
|
13
|
+
"@batijs/features": "0.0.436",
|
|
14
|
+
"@batijs/compile": "0.0.436"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@batijs/core": "0.0.
|
|
17
|
+
"@batijs/core": "0.0.436"
|
|
18
18
|
},
|
|
19
19
|
"main": "./dist/index.js",
|
|
20
20
|
"module": "./dist/index.js",
|