@batijs/build 0.0.629 → 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
@@ -116,7 +116,9 @@ async function transformFileAfterExec(filepath, fileContent) {
116
116
  case ".env.production.local":
117
117
  case ".html":
118
118
  case ".md":
119
- case ".toml": return fileContent;
119
+ case ".toml":
120
+ case "Dockerfile":
121
+ case ".dockerignore": return fileContent;
120
122
  case ".json":
121
123
  case ".jsonc":
122
124
  if (typeof fileContent === "string") return fileContent;
@@ -131,7 +133,7 @@ async function transformFileAfterExec(filepath, fileContent) {
131
133
  async function importTransformer(p) {
132
134
  return (await (isWin ? import(`file://${p}`) : import(p))).default;
133
135
  }
134
- async function executeOperationTransform(op, { meta, previousOperationSameDestination, packageJson }) {
136
+ async function executeOperationTransform(op, { meta, previousOperationSameDestination, packageJson, env }) {
135
137
  const transformer = await importTransformer(op.sourceAbsolute);
136
138
  const previousContent = previousOperationSameDestination?.content;
137
139
  const fileContent = await transformFileAfterExec(op.destination, await transformer({
@@ -139,7 +141,8 @@ async function executeOperationTransform(op, { meta, previousOperationSameDestin
139
141
  meta,
140
142
  source: op.source,
141
143
  target: op.destination,
142
- packageJson
144
+ packageJson,
145
+ env
143
146
  }));
144
147
  return { content: fileContent !== null ? fileContent : void 0 };
145
148
  }
@@ -249,6 +252,7 @@ async function* walk(dir) {
249
252
  }
250
253
  async function main(options, meta) {
251
254
  const sources = Array.isArray(options.source) ? options.source : [options.source];
255
+ const env = options.env ?? [];
252
256
  function updateAllImports(target, imports, includeIfImported) {
253
257
  const rf = new RelationFile(target, includeIfImported);
254
258
  if (!imports) return;
@@ -299,7 +303,8 @@ Please report this issue to https://github.com/vikejs/bati`);
299
303
  } else if (op.kind === "transform") report = await executeOperationTransform(op, {
300
304
  meta,
301
305
  previousOperationSameDestination: previousOp,
302
- packageJson
306
+ packageJson,
307
+ env
303
308
  });
304
309
  if (report.content) {
305
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.629",
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.629"
15
+ "@batijs/compile": "0.0.631"
16
16
  },
17
17
  "peerDependencies": {
18
- "@batijs/core": "0.0.629"
18
+ "@batijs/core": "0.0.631"
19
19
  },
20
20
  "main": "./dist/index.js",
21
21
  "module": "./dist/index.js",