@batijs/build 0.0.435 → 0.0.437

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 +14 -3
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -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 {
@@ -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.435",
3
+ "version": "0.0.437",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -10,11 +10,11 @@
10
10
  "devDependencies": {
11
11
  "@types/node": "^18.19.103",
12
12
  "tsup": "^8.5.0",
13
- "@batijs/compile": "0.0.435",
14
- "@batijs/features": "0.0.435"
13
+ "@batijs/features": "0.0.437",
14
+ "@batijs/compile": "0.0.437"
15
15
  },
16
16
  "dependencies": {
17
- "@batijs/core": "0.0.435"
17
+ "@batijs/core": "0.0.437"
18
18
  },
19
19
  "main": "./dist/index.js",
20
20
  "module": "./dist/index.js",