@xyd-js/documan 0.1.0-xyd.3 → 0.1.0-xyd.32
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/LICENSE +21 -0
- package/package.json +24 -22
- package/host/app/root.tsx +0 -23
- package/host/app/routes.ts +0 -5
- package/host/package.json +0 -43
- package/host/postcss.config.cjs +0 -5
- package/host/react-router.config.ts +0 -8
- package/host/tsconfig.json +0 -22
- package/host/vite.config.ts +0 -9
- package/src/commands/build.ts +0 -4
- package/src/commands/dev.ts +0 -5
- package/src/commands/serve.ts +0 -5
- package/src/index.ts +0 -7
- package/src/run/build.ts +0 -98
- package/src/run/dev.ts +0 -76
- package/src/run/index.ts +0 -6
- package/src/run/serve.ts +0 -106
- package/tsconfig.json +0 -22
- package/tsup.config.ts +0 -81
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 xyd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyd-js/documan",
|
|
3
|
-
"version": "0.1.0-xyd.
|
|
3
|
+
"version": "0.1.0-xyd.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json",
|
|
7
7
|
".": "./dist/index.js",
|
|
8
8
|
"./dev": "./dist/dev.js",
|
|
9
|
-
"./build": "./dist/build.js"
|
|
10
|
-
"./serve": "./dist/serve.js"
|
|
9
|
+
"./build": "./dist/build.js"
|
|
11
10
|
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"package.json"
|
|
14
|
+
],
|
|
12
15
|
"dependencies": {
|
|
13
|
-
"@
|
|
14
|
-
"@react-router/
|
|
15
|
-
"@react-router/
|
|
16
|
-
"@react-router/
|
|
16
|
+
"@iconify/tools": "^4.1.2",
|
|
17
|
+
"@react-router/dev": "^7.5.0",
|
|
18
|
+
"@react-router/node": "^7.5.0",
|
|
19
|
+
"@react-router/serve": "^7.5.0",
|
|
20
|
+
"@svgr/core": "^8.1.0",
|
|
21
|
+
"@svgr/plugin-jsx": "^8.1.0",
|
|
22
|
+
"cli-spinners": "^3.0.0",
|
|
17
23
|
"codehike": "^1.0.3",
|
|
18
24
|
"compression": "^1.7.5",
|
|
19
25
|
"express": "^4.21.2",
|
|
@@ -22,37 +28,33 @@
|
|
|
22
28
|
"isbot": "^5.1.17",
|
|
23
29
|
"lightningcss": "^1.27.0",
|
|
24
30
|
"morgan": "^1.10.0",
|
|
25
|
-
"react": "^
|
|
26
|
-
"react-dom": "^18.3.1",
|
|
27
|
-
"react-router": "^7.1.1",
|
|
31
|
+
"react-router": "^7.5.0",
|
|
28
32
|
"remark-frontmatter": "^5.0.0",
|
|
29
33
|
"remark-gfm": "^4.0.0",
|
|
30
34
|
"remark-mdx-frontmatter": "^5.0.0",
|
|
31
35
|
"source-map-support": "^0.5.21",
|
|
32
36
|
"typescript": "^5.6.3",
|
|
37
|
+
"unplugin-auto-import": "^19.2.0",
|
|
38
|
+
"unplugin-icons": "^22.1.0",
|
|
33
39
|
"vfile": "^6.0.3",
|
|
34
40
|
"yaml": "^2.6.0",
|
|
35
|
-
"@xyd-js/content": "0.1.0-xyd.
|
|
36
|
-
"@xyd-js/
|
|
37
|
-
"@xyd-js/
|
|
38
|
-
"@xyd-js/
|
|
39
|
-
"@xyd-js/
|
|
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
|
+
"@xyd-js/content": "0.1.0-xyd.16",
|
|
42
|
+
"@xyd-js/core": "0.1.0-xyd.15",
|
|
43
|
+
"@xyd-js/plugin-docs": "0.1.0-xyd.3",
|
|
44
|
+
"@xyd-js/uniform": "0.1.0-xyd.17",
|
|
45
|
+
"@xyd-js/plugins": "0.1.0-xyd.2"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
48
|
"@mdx-js/rollup": "^3.1.0",
|
|
47
49
|
"@types/node": "^22.7.5",
|
|
48
|
-
"@types/react": "^
|
|
49
|
-
"@types/react-dom": "^
|
|
50
|
+
"@types/react": "^19.0.0",
|
|
51
|
+
"@types/react-dom": "^19.0.0",
|
|
50
52
|
"@vitejs/plugin-react": "^4.3.2",
|
|
51
53
|
"autoprefixer": "^10.4.20",
|
|
52
54
|
"postcss": "^8.4.47",
|
|
53
55
|
"tsup": "^8.3.0",
|
|
54
56
|
"typescript": "^5.6.2",
|
|
55
|
-
"vite": "^
|
|
57
|
+
"vite": "^6.1.0",
|
|
56
58
|
"vite-tsconfig-paths": "^5.0.1"
|
|
57
59
|
},
|
|
58
60
|
"scripts": {
|
package/host/app/root.tsx
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
}
|
package/host/app/routes.ts
DELETED
package/host/package.json
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
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
|
-
}
|
package/host/postcss.config.cjs
DELETED
package/host/tsconfig.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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/host/vite.config.ts
DELETED
package/src/commands/build.ts
DELETED
package/src/commands/dev.ts
DELETED
package/src/commands/serve.ts
DELETED
package/src/index.ts
DELETED
package/src/run/build.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
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
DELETED
package/src/run/serve.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
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
|
-
})
|