@jayjiang/byoao 1.0.5 → 1.0.6
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 +30559 -79
- package/dist/lib/cjs-modules.js +15 -41
- package/dist/lib/cjs-modules.js.map +1 -1
- package/package.json +3 -2
package/dist/lib/cjs-modules.js
CHANGED
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
* Bun CJS interop shim.
|
|
3
|
-
*
|
|
4
|
-
* Bun 1.3.x has a pervasive bug with CJS/ESM interop: it loads CJS sub-modules
|
|
5
|
-
* as ESM and then fails with "Missing 'default' export" for any file that uses
|
|
6
|
-
* `module.exports` instead of `export default`. This affects fs-extra AND its
|
|
7
|
-
* own ESM wrapper (`fs-extra/esm`), making fs-extra completely unusable in Bun.
|
|
8
|
-
*
|
|
9
|
-
* Solution for fs: build a drop-in replacement from native Node.js APIs.
|
|
10
|
-
* Solution for handlebars/gray-matter/semver: createRequire works fine in Bun
|
|
11
|
-
* for packages that have NO `exports` field.
|
|
12
|
-
*/
|
|
13
|
-
import { createRequire } from "node:module";
|
|
1
|
+
// ── native Node.js fs replacement ─────────────────────────────────────────────
|
|
14
2
|
import * as nodeFs from "node:fs";
|
|
15
3
|
import * as nodeFsPromises from "node:fs/promises";
|
|
16
|
-
import
|
|
17
|
-
// ── fs-extra polyfills (native Node.js only) ──────────────────────────────────
|
|
4
|
+
import nodePath from "node:path";
|
|
18
5
|
async function copy(src, dest) {
|
|
19
6
|
await nodeFsPromises.cp(src, dest, { recursive: true });
|
|
20
7
|
}
|
|
@@ -34,20 +21,19 @@ function pathExistsSync(filePath) {
|
|
|
34
21
|
return nodeFs.existsSync(filePath);
|
|
35
22
|
}
|
|
36
23
|
async function readJson(filePath) {
|
|
37
|
-
|
|
38
|
-
return JSON.parse(content);
|
|
24
|
+
return JSON.parse(await nodeFsPromises.readFile(filePath, "utf-8"));
|
|
39
25
|
}
|
|
40
26
|
function readJsonSync(filePath) {
|
|
41
27
|
return JSON.parse(nodeFs.readFileSync(filePath, "utf-8"));
|
|
42
28
|
}
|
|
43
29
|
async function writeJson(filePath, data, options) {
|
|
44
30
|
const indent = options?.spaces ?? 2;
|
|
45
|
-
await nodeFsPromises.mkdir(
|
|
31
|
+
await nodeFsPromises.mkdir(nodePath.dirname(filePath), { recursive: true });
|
|
46
32
|
await nodeFsPromises.writeFile(filePath, JSON.stringify(data, null, indent));
|
|
47
33
|
}
|
|
48
34
|
function writeJsonSync(filePath, data, options) {
|
|
49
35
|
const indent = options?.spaces ?? 2;
|
|
50
|
-
nodeFs.mkdirSync(
|
|
36
|
+
nodeFs.mkdirSync(nodePath.dirname(filePath), { recursive: true });
|
|
51
37
|
nodeFs.writeFileSync(filePath, JSON.stringify(data, null, indent));
|
|
52
38
|
}
|
|
53
39
|
async function remove(filePath) {
|
|
@@ -57,34 +43,22 @@ function removeSync(filePath) {
|
|
|
57
43
|
nodeFs.rmSync(filePath, { recursive: true, force: true });
|
|
58
44
|
}
|
|
59
45
|
export const fs = {
|
|
60
|
-
// node:fs sync
|
|
61
46
|
existsSync: nodeFs.existsSync,
|
|
62
47
|
readFileSync: nodeFs.readFileSync,
|
|
63
48
|
readdirSync: nodeFs.readdirSync,
|
|
64
|
-
// node:fs/promises async
|
|
65
49
|
readFile: nodeFsPromises.readFile,
|
|
66
50
|
writeFile: nodeFsPromises.writeFile,
|
|
67
51
|
readdir: nodeFsPromises.readdir,
|
|
68
52
|
mkdir: nodeFsPromises.mkdir,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
pathExists,
|
|
73
|
-
pathExistsSync,
|
|
74
|
-
readJson,
|
|
75
|
-
readJsonSync,
|
|
76
|
-
writeJson,
|
|
77
|
-
writeJsonSync,
|
|
78
|
-
remove,
|
|
79
|
-
removeSync,
|
|
53
|
+
copy, ensureDir, pathExists, pathExistsSync,
|
|
54
|
+
readJson, readJsonSync, writeJson, writeJsonSync,
|
|
55
|
+
remove, removeSync,
|
|
80
56
|
};
|
|
81
|
-
// ── CJS
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
export const
|
|
88
|
-
export const Handlebars = unwrap(_Handlebars);
|
|
89
|
-
export const semver = unwrap(_semver);
|
|
57
|
+
// ── CJS packages — bundled inline by esbuild ─────────────────────────────────
|
|
58
|
+
import _matter from "gray-matter";
|
|
59
|
+
import _Handlebars from "handlebars";
|
|
60
|
+
import * as _semver from "semver";
|
|
61
|
+
export const matter = _matter;
|
|
62
|
+
export const Handlebars = _Handlebars;
|
|
63
|
+
export const semver = _semver;
|
|
90
64
|
//# sourceMappingURL=cjs-modules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cjs-modules.js","sourceRoot":"","sources":["../../src/lib/cjs-modules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cjs-modules.js","sourceRoot":"","sources":["../../src/lib/cjs-modules.ts"],"names":[],"mappings":"AAeA,iFAAiF;AACjF,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,QAAQ,MAAM,WAAW,CAAC;AAEjC,KAAK,UAAU,IAAI,CAAC,GAAW,EAAE,IAAY;IAC3C,MAAM,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1D,CAAC;AACD,KAAK,UAAU,SAAS,CAAC,OAAe;IACtC,MAAM,cAAc,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC3D,CAAC;AACD,KAAK,UAAU,UAAU,CAAC,QAAgB;IACxC,IAAI,CAAC;QAAC,MAAM,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;IAA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ACpC,MAAM,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACtE,CAAC;AACD,SAAS,UAAU,CAAC,QAAgB;IAClC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,CAAC,MAAM,EAAE,GAAG;IAChB,UAAU,EAAE,MAAM,CAAC,UAAU;IAC7B,YAAY,EAAE,MAAM,CAAC,YAAY;IACjC,WAAW,EAAE,MAAM,CAAC,WAAW;IAC/B,QAAQ,EAAE,cAAc,CAAC,QAAQ;IACjC,SAAS,EAAE,cAAc,CAAC,SAAS;IACnC,OAAO,EAAE,cAAc,CAAC,OAAO;IAC/B,KAAK,EAAE,cAAc,CAAC,KAAK;IAC3B,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc;IAC3C,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa;IAChD,MAAM,EAAE,UAAU;CACU,CAAC;AAE/B,gFAAgF;AAChF,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,WAAW,MAAM,YAAY,CAAC;AACrC,OAAO,KAAK,OAAO,MAAM,QAAQ,CAAC;AAElC,MAAM,CAAC,MAAM,MAAM,GAAG,OAA4B,CAAC;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,WAAoC,CAAC;AAC/D,MAAM,CAAC,MAAM,MAAM,GAAG,OAA4B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jayjiang/byoao",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Build Your Own AI OS — Obsidian + AI Agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"byoao": "dist/cli/cli-program.js"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
-
"build": "
|
|
15
|
+
"build": "node build.mjs",
|
|
16
16
|
"dev": "node --import tsx src/cli/cli-program.ts",
|
|
17
17
|
"test": "vitest run",
|
|
18
18
|
"typecheck": "tsc --noEmit",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"@types/inquirer": "^9.0.0",
|
|
59
59
|
"@types/node": "^20.0.0",
|
|
60
60
|
"@types/semver": "^7.7.1",
|
|
61
|
+
"esbuild": "^0.27.7",
|
|
61
62
|
"tsx": "^4.21.0",
|
|
62
63
|
"typescript": "^5.4.0",
|
|
63
64
|
"vitest": "^4.1.0"
|