@batijs/build 0.0.23 → 0.0.25
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/README.md +3 -3
- package/dist/exec.js +6 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# @batijs/build
|
|
2
|
-
|
|
3
|
-
WIP
|
|
1
|
+
# @batijs/build
|
|
2
|
+
|
|
3
|
+
WIP
|
package/dist/exec.js
CHANGED
|
@@ -4,6 +4,7 @@ import { copyFile, mkdir, opendir, readFile, writeFile } from "fs/promises";
|
|
|
4
4
|
import { existsSync } from "fs";
|
|
5
5
|
import path from "path";
|
|
6
6
|
var reIgnoreFile = /^(chunk-|asset-|#)/gi;
|
|
7
|
+
var isWin = process.platform === "win32";
|
|
7
8
|
function toDist(filepath, source, dist) {
|
|
8
9
|
const split = filepath.split(path.sep);
|
|
9
10
|
split[split.length - 1] = split[split.length - 1].replace(/^\$\$?(.*)\.[tj]sx?$/, "$1");
|
|
@@ -35,6 +36,8 @@ async function* walk(dir) {
|
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
function transformFileAfterExec(filepath, fileContent) {
|
|
39
|
+
if (fileContent === void 0 || fileContent === null)
|
|
40
|
+
return null;
|
|
38
41
|
const parsed = path.parse(filepath);
|
|
39
42
|
const ext = parsed.ext || parsed.name;
|
|
40
43
|
switch (ext) {
|
|
@@ -43,6 +46,7 @@ function transformFileAfterExec(filepath, fileContent) {
|
|
|
43
46
|
case ".tsx":
|
|
44
47
|
case ".jsx":
|
|
45
48
|
case ".env":
|
|
49
|
+
case ".html":
|
|
46
50
|
return fileContent;
|
|
47
51
|
case ".json":
|
|
48
52
|
return JSON.stringify(fileContent, null, 2);
|
|
@@ -69,7 +73,8 @@ async function main(options, meta) {
|
|
|
69
73
|
Please report this issue to https://github.com/magne4000/bati`
|
|
70
74
|
);
|
|
71
75
|
} else if (parsed.name.startsWith("$") && parsed.ext.match(/\.jsx?$/)) {
|
|
72
|
-
const
|
|
76
|
+
const importFile = isWin ? "file://" + p : p;
|
|
77
|
+
const f = await import(importFile);
|
|
73
78
|
const fileContent = transformFileAfterExec(
|
|
74
79
|
target,
|
|
75
80
|
await f.default(targets.has(target) ? () => readFile(target, { encoding: "utf-8" }) : void 0, meta)
|
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@batijs/build",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [],
|
|
7
7
|
"author": "",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@types/node": "^16.18.
|
|
11
|
-
"
|
|
10
|
+
"@types/node": "^16.18.36",
|
|
11
|
+
"tsup": "^6.7.0",
|
|
12
|
+
"@batijs/tsup": "0.0.25"
|
|
12
13
|
},
|
|
13
14
|
"dependencies": {
|
|
14
|
-
"@batijs/core": "0.0.
|
|
15
|
+
"@batijs/core": "0.0.25"
|
|
15
16
|
},
|
|
16
17
|
"main": "./dist/exec.js",
|
|
17
18
|
"module": "./dist/exec.js",
|