@batijs/build 0.0.630 → 0.0.631

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.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import { VikeMeta } from "@batijs/core";
1
+ import { EnvRegistry, VikeMeta } from "@batijs/core";
2
2
 
3
3
  //#region src/index.d.ts
4
4
  declare function walk(dir: string): AsyncGenerator<string>;
5
5
  declare function main(options: {
6
6
  source: string | string[];
7
7
  dist: string;
8
+ env?: EnvRegistry;
8
9
  }, meta: VikeMeta): Promise<void>;
9
10
  //#endregion
10
11
  export { main as default, walk };
package/dist/index.js CHANGED
@@ -133,7 +133,7 @@ async function transformFileAfterExec(filepath, fileContent) {
133
133
  async function importTransformer(p) {
134
134
  return (await (isWin ? import(`file://${p}`) : import(p))).default;
135
135
  }
136
- async function executeOperationTransform(op, { meta, previousOperationSameDestination, packageJson }) {
136
+ async function executeOperationTransform(op, { meta, previousOperationSameDestination, packageJson, env }) {
137
137
  const transformer = await importTransformer(op.sourceAbsolute);
138
138
  const previousContent = previousOperationSameDestination?.content;
139
139
  const fileContent = await transformFileAfterExec(op.destination, await transformer({
@@ -141,7 +141,8 @@ async function executeOperationTransform(op, { meta, previousOperationSameDestin
141
141
  meta,
142
142
  source: op.source,
143
143
  target: op.destination,
144
- packageJson
144
+ packageJson,
145
+ env
145
146
  }));
146
147
  return { content: fileContent !== null ? fileContent : void 0 };
147
148
  }
@@ -251,6 +252,7 @@ async function* walk(dir) {
251
252
  }
252
253
  async function main(options, meta) {
253
254
  const sources = Array.isArray(options.source) ? options.source : [options.source];
255
+ const env = options.env ?? [];
254
256
  function updateAllImports(target, imports, includeIfImported) {
255
257
  const rf = new RelationFile(target, includeIfImported);
256
258
  if (!imports) return;
@@ -301,7 +303,8 @@ Please report this issue to https://github.com/vikejs/bati`);
301
303
  } else if (op.kind === "transform") report = await executeOperationTransform(op, {
302
304
  meta,
303
305
  previousOperationSameDestination: previousOp,
304
- packageJson
306
+ packageJson,
307
+ env
305
308
  });
306
309
  if (report.content) {
307
310
  await safeWriteFile(op.destination, report.content.trimStart());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@batijs/build",
3
- "version": "0.0.630",
3
+ "version": "0.0.631",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -12,10 +12,10 @@
12
12
  "@batijs/features": "",
13
13
  "@types/node": "^20.19.37",
14
14
  "tsdown": "^0.22.0",
15
- "@batijs/compile": "0.0.630"
15
+ "@batijs/compile": "0.0.631"
16
16
  },
17
17
  "peerDependencies": {
18
- "@batijs/core": "0.0.630"
18
+ "@batijs/core": "0.0.631"
19
19
  },
20
20
  "main": "./dist/index.js",
21
21
  "module": "./dist/index.js",