@xyd-js/documan 0.1.0-xyd.18 → 0.1.0-xyd.3
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/host/app/root.tsx +23 -0
- package/host/app/routes.ts +5 -0
- package/host/package.json +43 -0
- package/host/postcss.config.cjs +5 -0
- package/host/react-router.config.ts +8 -0
- package/host/tsconfig.json +22 -0
- package/host/vite.config.ts +9 -0
- package/package.json +14 -11
- package/src/commands/build.ts +4 -0
- package/src/commands/dev.ts +5 -0
- package/src/commands/serve.ts +5 -0
- package/src/index.ts +7 -0
- package/src/run/build.ts +98 -0
- package/src/run/dev.ts +76 -0
- package/src/run/index.ts +6 -0
- package/src/run/serve.ts +106 -0
- package/tsconfig.json +22 -0
- package/tsup.config.ts +81 -0
- package/dist/build.d.ts +0 -2
- package/dist/build.js +0 -118
- package/dist/build.js.map +0 -1
- package/dist/dev.d.ts +0 -2
- package/dist/dev.js +0 -86
- package/dist/dev.js.map +0 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -240
- package/dist/index.js.map +0 -1
- package/dist/serve.d.ts +0 -2
- package/dist/serve.js +0 -110
- package/dist/serve.js.map +0 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from "react-router";
|
|
2
|
+
|
|
3
|
+
export function Layout({ children }: { children: React.ReactNode }) {
|
|
4
|
+
return (
|
|
5
|
+
<html lang="en">
|
|
6
|
+
<head>
|
|
7
|
+
<meta charSet="utf-8" />
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
9
|
+
<Meta />
|
|
10
|
+
<Links />
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
{children}
|
|
14
|
+
<ScrollRestoration />
|
|
15
|
+
<Scripts />
|
|
16
|
+
</body>
|
|
17
|
+
</html>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default function App() {
|
|
22
|
+
return <Outlet />;
|
|
23
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"private": true,
|
|
3
|
+
"name": "@xyd-js/documan-host",
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {},
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@xyd-js/atlas": "workspace:*",
|
|
9
|
+
"@xyd-js/core": "workspace:*",
|
|
10
|
+
"@xyd-js/content": "workspace:*",
|
|
11
|
+
"@xyd-js/framework": "workspace:*",
|
|
12
|
+
"@xyd-js/gql": "workspace:*",
|
|
13
|
+
"@xyd-js/openapi": "workspace:*",
|
|
14
|
+
"@xyd-js/uniform": "workspace:*",
|
|
15
|
+
"@xyd-js/theme-gusto": "workspace:*",
|
|
16
|
+
"@react-router/node": "^7.1.1",
|
|
17
|
+
"@react-router/serve": "^7.1.1",
|
|
18
|
+
"codehike": "^1.0.3",
|
|
19
|
+
"express": "^4.21.1",
|
|
20
|
+
"isbot": "^5.1.17",
|
|
21
|
+
"react": "^18.3.1",
|
|
22
|
+
"react-dom": "^18.3.1",
|
|
23
|
+
"react-router": "^7.1.1",
|
|
24
|
+
"remark-frontmatter": "^5.0.0",
|
|
25
|
+
"remark-gfm": "^4.0.0",
|
|
26
|
+
"remark-mdx-frontmatter": "^5.0.0",
|
|
27
|
+
"typescript": "^5.6.3",
|
|
28
|
+
"vfile": "^6.0.3",
|
|
29
|
+
"yaml": "^2.6.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "^22.7.5",
|
|
33
|
+
"@types/react-dom": "^18.3.1",
|
|
34
|
+
"@mdx-js/rollup": "^3.1.0",
|
|
35
|
+
"@types/react": "^18.3.9",
|
|
36
|
+
"@vitejs/plugin-react": "^4.3.2",
|
|
37
|
+
"autoprefixer": "^10.4.20",
|
|
38
|
+
"postcss": "^8.4.47",
|
|
39
|
+
"typescript": "^5.6.2",
|
|
40
|
+
"vite": "^5.4.9",
|
|
41
|
+
"vite-tsconfig-paths": "^5.0.1"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"lib": [
|
|
7
|
+
"ES2020",
|
|
8
|
+
"DOM",
|
|
9
|
+
"DOM.Iterable"
|
|
10
|
+
],
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"isolatedModules": true,
|
|
15
|
+
"noEmit": false,
|
|
16
|
+
"strict": true,
|
|
17
|
+
"noUnusedLocals": true,
|
|
18
|
+
"noUnusedParameters": true,
|
|
19
|
+
"noFallthroughCasesInSwitch": true,
|
|
20
|
+
"jsx": "react-jsx"
|
|
21
|
+
}
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyd-js/documan",
|
|
3
|
-
"version": "0.1.0-xyd.
|
|
3
|
+
"version": "0.1.0-xyd.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json",
|
|
@@ -9,10 +9,6 @@
|
|
|
9
9
|
"./build": "./dist/build.js",
|
|
10
10
|
"./serve": "./dist/serve.js"
|
|
11
11
|
},
|
|
12
|
-
"files": [
|
|
13
|
-
"dist",
|
|
14
|
-
"package.json"
|
|
15
|
-
],
|
|
16
12
|
"dependencies": {
|
|
17
13
|
"@xyd-js/react-router-dev": "7.1.1-xyd.3",
|
|
18
14
|
"@react-router/node": "^7.1.1",
|
|
@@ -26,8 +22,8 @@
|
|
|
26
22
|
"isbot": "^5.1.17",
|
|
27
23
|
"lightningcss": "^1.27.0",
|
|
28
24
|
"morgan": "^1.10.0",
|
|
29
|
-
"react": "^
|
|
30
|
-
"react-dom": "^
|
|
25
|
+
"react": "^18.3.1",
|
|
26
|
+
"react-dom": "^18.3.1",
|
|
31
27
|
"react-router": "^7.1.1",
|
|
32
28
|
"remark-frontmatter": "^5.0.0",
|
|
33
29
|
"remark-gfm": "^4.0.0",
|
|
@@ -36,14 +32,21 @@
|
|
|
36
32
|
"typescript": "^5.6.3",
|
|
37
33
|
"vfile": "^6.0.3",
|
|
38
34
|
"yaml": "^2.6.0",
|
|
39
|
-
"@xyd-js/content": "0.1.0-xyd.
|
|
40
|
-
"@xyd-js/
|
|
35
|
+
"@xyd-js/content": "0.1.0-xyd.3",
|
|
36
|
+
"@xyd-js/atlas": "0.1.0-xyd.4",
|
|
37
|
+
"@xyd-js/core": "0.1.0-xyd.1",
|
|
38
|
+
"@xyd-js/framework": "0.1.0-xyd.4",
|
|
39
|
+
"@xyd-js/openapi": "0.1.0-xyd.1",
|
|
40
|
+
"@xyd-js/gql": "0.1.0-xyd.1",
|
|
41
|
+
"@xyd-js/theme-poetry": "0.1.0-xyd.3",
|
|
42
|
+
"@xyd-js/plugin-zero": "0.1.0-xyd.3",
|
|
43
|
+
"@xyd-js/uniform": "0.1.0-xyd.3"
|
|
41
44
|
},
|
|
42
45
|
"devDependencies": {
|
|
43
46
|
"@mdx-js/rollup": "^3.1.0",
|
|
44
47
|
"@types/node": "^22.7.5",
|
|
45
|
-
"@types/react": "^
|
|
46
|
-
"@types/react-dom": "^
|
|
48
|
+
"@types/react": "^18.3.9",
|
|
49
|
+
"@types/react-dom": "^18.3.1",
|
|
47
50
|
"@vitejs/plugin-react": "^4.3.2",
|
|
48
51
|
"autoprefixer": "^10.4.20",
|
|
49
52
|
"postcss": "^8.4.47",
|
package/src/index.ts
ADDED
package/src/run/build.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import {fileURLToPath} from "node:url";
|
|
4
|
+
|
|
5
|
+
import {build as viteBuild} from 'vite';
|
|
6
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
7
|
+
|
|
8
|
+
import {reactRouter} from "@xyd-js/react-router-dev/vite";
|
|
9
|
+
// import { reactRouter } from "@react-router/dev/vite";
|
|
10
|
+
|
|
11
|
+
import {vitePlugins as xydContentVitePlugins} from "@xyd-js/content"
|
|
12
|
+
import {pluginZero} from "@xyd-js/plugin-zero";
|
|
13
|
+
|
|
14
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
+
const __dirname = path.dirname(__filename);
|
|
16
|
+
|
|
17
|
+
// Define the main function to run the builds
|
|
18
|
+
export async function build() {
|
|
19
|
+
const resp = await pluginZero()
|
|
20
|
+
if (!resp) {
|
|
21
|
+
throw new Error("PluginZero not found")
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const buildDir = path.join(process.cwd(), ".xyd/build");
|
|
25
|
+
|
|
26
|
+
{
|
|
27
|
+
const packageJsonPath = path.join(buildDir, 'package.json');
|
|
28
|
+
|
|
29
|
+
const packageJsonContent = {
|
|
30
|
+
type: "module",
|
|
31
|
+
scripts: {},
|
|
32
|
+
dependencies: {},
|
|
33
|
+
devDependencies: {}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// Ensure the build directory exists
|
|
37
|
+
if (!fs.existsSync(buildDir)) {
|
|
38
|
+
fs.mkdirSync(buildDir, {recursive: true});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Write the package.json file
|
|
42
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJsonContent, null, 2), 'utf8');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
// Build the client-side bundle
|
|
47
|
+
await viteBuild({
|
|
48
|
+
root: path.join(__dirname, "../host"),
|
|
49
|
+
// @ts-ignore
|
|
50
|
+
plugins: [
|
|
51
|
+
...(xydContentVitePlugins({
|
|
52
|
+
toc: {
|
|
53
|
+
minDepth: 2,
|
|
54
|
+
}
|
|
55
|
+
}) as Plugin[]),
|
|
56
|
+
reactRouter({
|
|
57
|
+
outDir: buildDir,
|
|
58
|
+
routes: resp.routes
|
|
59
|
+
}),
|
|
60
|
+
tsconfigPaths(),
|
|
61
|
+
...resp.vitePlugins
|
|
62
|
+
],
|
|
63
|
+
optimizeDeps: {
|
|
64
|
+
include: ["react/jsx-runtime"],
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Build the SSR bundle
|
|
69
|
+
await viteBuild({
|
|
70
|
+
root: path.join(__dirname, "../host"),
|
|
71
|
+
build: {
|
|
72
|
+
ssr: true,
|
|
73
|
+
},
|
|
74
|
+
// @ts-ignore
|
|
75
|
+
plugins: [
|
|
76
|
+
...(xydContentVitePlugins({
|
|
77
|
+
toc: {
|
|
78
|
+
minDepth: 2,
|
|
79
|
+
}
|
|
80
|
+
}) as Plugin[]),
|
|
81
|
+
reactRouter({
|
|
82
|
+
outDir: buildDir,
|
|
83
|
+
routes: resp.routes
|
|
84
|
+
}),
|
|
85
|
+
tsconfigPaths(),
|
|
86
|
+
...resp.vitePlugins
|
|
87
|
+
],
|
|
88
|
+
optimizeDeps: {
|
|
89
|
+
include: ["react/jsx-runtime"],
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
console.log('Build completed successfully.'); // TODO: better message
|
|
94
|
+
} catch (error) {
|
|
95
|
+
console.error('Build failed:', error); // TODO: better message
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
package/src/run/dev.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import {fileURLToPath} from "node:url";
|
|
3
|
+
import {createServer, searchForWorkspaceRoot} from "vite";
|
|
4
|
+
|
|
5
|
+
import {reactRouter} from "@xyd-js/react-router-dev/vite";
|
|
6
|
+
// import { reactRouter } from "@react-router/dev/vite";
|
|
7
|
+
|
|
8
|
+
import {vitePlugins as xydContentVitePlugins} from "@xyd-js/content";
|
|
9
|
+
import {pluginZero} from "@xyd-js/plugin-zero";
|
|
10
|
+
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
+
const __dirname = path.dirname(__filename);
|
|
13
|
+
|
|
14
|
+
const port = process.env.XYD_PORT ? parseInt(process.env.XYD_PORT) : 5175;
|
|
15
|
+
|
|
16
|
+
export async function dev() {
|
|
17
|
+
const resp = await pluginZero()
|
|
18
|
+
if (!resp) {
|
|
19
|
+
throw new Error("PluginZero not found")
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const allowCwd = searchForWorkspaceRoot(process.cwd())
|
|
23
|
+
|
|
24
|
+
const preview = await createServer({
|
|
25
|
+
// any valid user config options, plus `mode` and `configFile`
|
|
26
|
+
// configFile: path.join(__dirname, "../src/vite/empty-config.ts"), // TODO: bundler??
|
|
27
|
+
// configFile: path.join(__dirname, "../"), // TODO: bundler??
|
|
28
|
+
// root: path.join(__dirname, "../"), // TODO: bundler?
|
|
29
|
+
root: process.env.XYD_DOCUMAN_HOST || path.join(__dirname, "../host"), // TODO: bundler?
|
|
30
|
+
server: {
|
|
31
|
+
port: port,
|
|
32
|
+
fs: {
|
|
33
|
+
allow: [
|
|
34
|
+
allowCwd,
|
|
35
|
+
process.env.XYD_CLI ? path.join(__dirname, "../../") : "",
|
|
36
|
+
// path.join(__dirname, "../node_modules") // Ensure node_modules from xyd-documan is included
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
build: {
|
|
41
|
+
rollupOptions: {
|
|
42
|
+
// Exclude package `B` from the client-side bundle
|
|
43
|
+
external: ["@xyd-js/uniform", "@xyd-js/uniform/content", "@xyd-js/plugin-zero"],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
ssr: {
|
|
47
|
+
external: ["@xyd-js/uniform", "@xyd-js/uniform/content", "@xyd-js/plugin-zero"],
|
|
48
|
+
// noExternal: [
|
|
49
|
+
// "@xyd-js/uniform",
|
|
50
|
+
// "@xyd-js/uniform/content",
|
|
51
|
+
// "@xyd-js/plugin-zero"
|
|
52
|
+
// ],
|
|
53
|
+
},
|
|
54
|
+
optimizeDeps: {
|
|
55
|
+
include: ["react/jsx-runtime"],
|
|
56
|
+
},
|
|
57
|
+
// @ts-ignore
|
|
58
|
+
plugins: [ // TODO: fix plugin ts
|
|
59
|
+
...(xydContentVitePlugins({
|
|
60
|
+
toc: {
|
|
61
|
+
minDepth: 2,
|
|
62
|
+
}
|
|
63
|
+
}) as Plugin[]),
|
|
64
|
+
reactRouter({
|
|
65
|
+
routes: resp.routes
|
|
66
|
+
}),
|
|
67
|
+
...resp.vitePlugins
|
|
68
|
+
],
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
await preview.listen(port);
|
|
72
|
+
|
|
73
|
+
preview.printUrls();
|
|
74
|
+
preview.bindCLIShortcuts({print: true});
|
|
75
|
+
|
|
76
|
+
}
|
package/src/run/index.ts
ADDED
package/src/run/serve.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import url from "node:url";
|
|
5
|
+
|
|
6
|
+
import type {ServerBuild} from "react-router";
|
|
7
|
+
import {createRequestHandler} from "@react-router/express";
|
|
8
|
+
import compression from "compression";
|
|
9
|
+
import express from "express";
|
|
10
|
+
import morgan from "morgan";
|
|
11
|
+
import sourceMapSupport from "source-map-support";
|
|
12
|
+
import getPort from "get-port";
|
|
13
|
+
|
|
14
|
+
function parseNumber(raw?: string) {
|
|
15
|
+
if (raw === undefined) return undefined;
|
|
16
|
+
let maybe = Number(raw);
|
|
17
|
+
if (Number.isNaN(maybe)) return undefined;
|
|
18
|
+
return maybe;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export async function serve() {
|
|
22
|
+
process.env.NODE_ENV = process.env.NODE_ENV ?? "production";
|
|
23
|
+
|
|
24
|
+
sourceMapSupport.install({
|
|
25
|
+
retrieveSourceMap: function (source) {
|
|
26
|
+
let match = source.startsWith("file://");
|
|
27
|
+
if (match) {
|
|
28
|
+
let filePath = url.fileURLToPath(source);
|
|
29
|
+
let sourceMapPath = `${filePath}.map`;
|
|
30
|
+
if (fs.existsSync(sourceMapPath)) {
|
|
31
|
+
return {
|
|
32
|
+
url: source,
|
|
33
|
+
map: fs.readFileSync(sourceMapPath, "utf8"),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
let port = parseNumber(process.env.PORT) ?? (await getPort({port: 3000}));
|
|
42
|
+
|
|
43
|
+
let buildPathArg = path.join(process.cwd(), ".xyd/build/server/index.js")
|
|
44
|
+
|
|
45
|
+
if (!buildPathArg) {
|
|
46
|
+
console.error(`
|
|
47
|
+
Usage: react-router-serve <server-build-path> - e.g. react-router-serve build/server/index.js`);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let buildPath = path.resolve(buildPathArg);
|
|
52
|
+
|
|
53
|
+
let build: ServerBuild = await import(url.pathToFileURL(buildPath).href);
|
|
54
|
+
|
|
55
|
+
let onListen = () => {
|
|
56
|
+
let address =
|
|
57
|
+
process.env.HOST ||
|
|
58
|
+
Object.values(os.networkInterfaces())
|
|
59
|
+
.flat()
|
|
60
|
+
.find((ip) => String(ip?.family).includes("4") && !ip?.internal)
|
|
61
|
+
?.address;
|
|
62
|
+
|
|
63
|
+
if (!address) {
|
|
64
|
+
console.log(`[xyd-serve] http://localhost:${port}`);
|
|
65
|
+
} else {
|
|
66
|
+
console.log(
|
|
67
|
+
`[xyd-serve] http://localhost:${port} (http://${address}:${port})`
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
build = {
|
|
73
|
+
...build,
|
|
74
|
+
assetsBuildDirectory: path.join(process.cwd(), ".xyd/build/client")
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let app = express();
|
|
78
|
+
app.disable("x-powered-by");
|
|
79
|
+
app.use(compression());
|
|
80
|
+
app.use(
|
|
81
|
+
path.posix.join(build.publicPath, "assets"),
|
|
82
|
+
express.static(path.join(build.assetsBuildDirectory, "assets"), {
|
|
83
|
+
immutable: true,
|
|
84
|
+
maxAge: "1y",
|
|
85
|
+
})
|
|
86
|
+
);
|
|
87
|
+
app.use(build.publicPath, express.static(build.assetsBuildDirectory));
|
|
88
|
+
app.use(express.static("public", {maxAge: "1h"}));
|
|
89
|
+
app.use(morgan("tiny"));
|
|
90
|
+
|
|
91
|
+
app.all(
|
|
92
|
+
"*",
|
|
93
|
+
createRequestHandler({
|
|
94
|
+
build,
|
|
95
|
+
mode: process.env.NODE_ENV,
|
|
96
|
+
})
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
let server = process.env.HOST
|
|
100
|
+
? app.listen(port, process.env.HOST, onListen)
|
|
101
|
+
: app.listen(port, onListen);
|
|
102
|
+
|
|
103
|
+
["SIGTERM", "SIGINT"].forEach((signal) => {
|
|
104
|
+
process.once(signal, () => server?.close(console.error));
|
|
105
|
+
});
|
|
106
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "esnext",
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"target": "esnext", // Change this to es2020 or esnext
|
|
7
|
+
"baseUrl": ".",
|
|
8
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"strict": false,
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"incremental": false,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"jsx": "preserve",
|
|
17
|
+
"plugins": [],
|
|
18
|
+
"strictNullChecks": true
|
|
19
|
+
},
|
|
20
|
+
"include": ["src/**/*.ts", "src/**/*.tsx", "host/**/*.ts", "host/**/*.tsx"],
|
|
21
|
+
"exclude": ["node_modules"]
|
|
22
|
+
}
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {defineConfig} from 'tsup';
|
|
2
|
+
import pkg from './package.json';
|
|
3
|
+
|
|
4
|
+
const deps = [
|
|
5
|
+
...Object.keys(pkg.dependencies || {}),
|
|
6
|
+
...Object.keys(pkg.devDependencies || {}),
|
|
7
|
+
].filter((dep) => [
|
|
8
|
+
"@xyd-js/core",
|
|
9
|
+
"@xyd-js/content",
|
|
10
|
+
"@xyd-js/framework",
|
|
11
|
+
"@xyd-js/ui",
|
|
12
|
+
"@xyd-js/openapi",
|
|
13
|
+
"@xyd-js/uniform",
|
|
14
|
+
"@xyd-js/theme-gusto",
|
|
15
|
+
// "@xyd-js/plugin-zero", // TODO: because plugin-zero has react-router dependency
|
|
16
|
+
].indexOf(dep) === -1)
|
|
17
|
+
|
|
18
|
+
export default defineConfig({
|
|
19
|
+
entry: {
|
|
20
|
+
index: 'src/index.ts',
|
|
21
|
+
dev: 'src/commands/dev.ts',
|
|
22
|
+
build: 'src/commands/build.ts',
|
|
23
|
+
serve: 'src/commands/serve.ts',
|
|
24
|
+
},
|
|
25
|
+
dts: {
|
|
26
|
+
entry: {
|
|
27
|
+
index: 'src/index.ts',
|
|
28
|
+
dev: 'src/commands/dev.ts',
|
|
29
|
+
build: 'src/commands/build.ts',
|
|
30
|
+
serve: 'src/commands/serve.ts',
|
|
31
|
+
},
|
|
32
|
+
resolve: true, // Resolve external types
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
format: ["esm"],
|
|
36
|
+
platform: 'node',
|
|
37
|
+
shims: false,
|
|
38
|
+
splitting: false,
|
|
39
|
+
sourcemap: true,
|
|
40
|
+
clean: true,
|
|
41
|
+
bundle: true, // Enable bundling
|
|
42
|
+
external: [
|
|
43
|
+
...deps,
|
|
44
|
+
|
|
45
|
+
// needed by @xyd-js/plugin-zero
|
|
46
|
+
"react-router",
|
|
47
|
+
"@react-router/dev",
|
|
48
|
+
"@react-router/express",
|
|
49
|
+
|
|
50
|
+
"@xyd-js/react-router-dev",
|
|
51
|
+
|
|
52
|
+
"@readme/json-schema-ref-parser",
|
|
53
|
+
"@apidevtools/json-schema-ref-parser",
|
|
54
|
+
//
|
|
55
|
+
|
|
56
|
+
//
|
|
57
|
+
// Externalize Node.js built-in modules
|
|
58
|
+
/^node:.*/,
|
|
59
|
+
'fs',
|
|
60
|
+
'path',
|
|
61
|
+
'url',
|
|
62
|
+
'os',
|
|
63
|
+
'http',
|
|
64
|
+
'https',
|
|
65
|
+
'stream',
|
|
66
|
+
'zlib',
|
|
67
|
+
'util',
|
|
68
|
+
'crypto',
|
|
69
|
+
'tty',
|
|
70
|
+
|
|
71
|
+
// "lightningcss",
|
|
72
|
+
// "vite",
|
|
73
|
+
// "vite-tsconfig-paths",
|
|
74
|
+
// "react-router",
|
|
75
|
+
// "@react-router/serve",
|
|
76
|
+
// "@react-router/dev",
|
|
77
|
+
// "@xydjs/react-router-dev",
|
|
78
|
+
// "@mdx-js/rollup",
|
|
79
|
+
// "@graphql-markdown"
|
|
80
|
+
], // Ensure no dependencies are marked as external
|
|
81
|
+
})
|
package/dist/build.d.ts
DELETED