xanix 1.0.0 → 1.0.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/dist/BaseDocument.d.ts +1 -1
- package/dist/BaseDocument.js +3 -3
- package/dist/bin/bundler/buildCache.js +6 -23
- package/dist/bin/bundler/plugins/XanixReactRefresh.js +33 -33
- package/dist/bin/bundler/plugins/XanixResolveCacheDeps/index.js +5 -0
- package/dist/bin/bundler/plugins/XanixTsconfigAlias.d.ts +2 -0
- package/dist/bin/bundler/plugins/{xanixTsconfigAlias.js → XanixTsconfigAlias.js} +3 -5
- package/dist/bin/bundler/plugins/plugins.js +6 -0
- package/dist/bin/bundler/watchClient.js +7 -1
- package/dist/bin/cli/build.js +3 -1
- package/dist/bin/cli/dev.js +3 -0
- package/dist/bin/cli/start copy.d.ts +2 -0
- package/dist/bin/cli/start copy.js +34 -0
- package/dist/bin/index.js +0 -0
- package/dist/client/client-runtime.d.ts +10 -0
- package/dist/client/client-runtime.js +98 -0
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +2 -2
- package/dist/client/navigation.d.ts +3 -4
- package/dist/client/navigation.js +23 -10
- package/dist/client/runtime.d.ts +1 -1
- package/dist/components/Document/context.d.ts +4 -10
- package/dist/components/Document/context.js +6 -5
- package/dist/components/Document/index.d.ts +6 -5
- package/dist/components/Document/index.js +3 -7
- package/dist/components/Head.js +1 -1
- package/dist/document/Body.js +1 -2
- package/dist/document/Document.js +1 -2
- package/dist/document/DocumentContext.d.ts +1 -0
- package/dist/document/Head.js +4 -3
- package/dist/document/index.d.ts +1 -1
- package/dist/document/index.js +1 -1
- package/dist/document/useDocument.d.ts +1 -1
- package/dist/hooks/useCookie.d.ts +2 -0
- package/dist/hooks/useCookie.js +13 -0
- package/dist/hooks/useData.js +1 -3
- package/dist/hooks/useRequest copy.d.ts +2 -0
- package/dist/hooks/useRequest copy.js +8 -0
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -4
- package/dist/navigation/navigate.js +6 -6
- package/dist/navigation/useLocation.js +1 -1
- package/dist/router/index.d.ts +3 -1
- package/dist/router/index.js +3 -1
- package/dist/router/useParams.d.ts +1 -9
- package/dist/router/useParams.js +3 -48
- package/dist/router/usePathname.d.ts +1 -0
- package/dist/router/usePathname.js +8 -0
- package/dist/router/useSearchParams.js +2 -8
- package/dist/runtime/createServer.d.ts +12 -0
- package/dist/runtime/createServer.js +40 -0
- package/dist/runtime/index.d.ts +12 -0
- package/dist/runtime/index.js +40 -0
- package/dist/runtime/readManifest.d.ts +14 -0
- package/dist/runtime/readManifest.js +8 -0
- package/dist/runtime/xanixPage.d.ts +9 -0
- package/dist/runtime/xanixPage.js +62 -0
- package/dist/server/createServer.d.ts +12 -0
- package/dist/server/createServer.js +40 -0
- package/dist/server/page.js +2 -0
- package/dist/server/runtime copy.d.ts +12 -0
- package/dist/server/runtime copy.js +40 -0
- package/dist/server/runtime.d.ts +12 -0
- package/dist/server/runtime.js +40 -0
- package/dist/server/xanixPage.d.ts +9 -0
- package/dist/server/xanixPage.js +62 -0
- package/dist/utils/index.d.ts +0 -9
- package/dist/utils/index.js +1 -27
- package/dist/xanix.js +12 -12
- package/package.json +73 -73
- package/{src/xanix-env.d.ts → xanix-env.d.ts} +79 -79
- package/dist/Document.d.ts +0 -7
- package/dist/Document.js +0 -7
- package/dist/bin/bundler/plugins/XanixWatchChange copy.d.ts +0 -10
- package/dist/bin/bundler/plugins/XanixWatchChange copy.js +0 -30
- package/dist/bin/bundler/plugins/XanixWatchChange.d.ts +0 -9
- package/dist/bin/bundler/plugins/XanixWatchChange.js +0 -27
- package/dist/bin/bundler/plugins/XanixWatchChangeClient.d.ts +0 -7
- package/dist/bin/bundler/plugins/XanixWatchChangeClient.js +0 -15
- package/dist/bin/bundler/plugins/pathResolver.d.ts +0 -5
- package/dist/bin/bundler/plugins/pathResolver.js +0 -57
- package/dist/bin/bundler/plugins/xanixServerData.d.ts +0 -6
- package/dist/bin/bundler/plugins/xanixServerData.js +0 -224
- package/dist/bin/bundler/plugins/xanixTsconfigAlias.d.ts +0 -6
- package/dist/client/components/Body.d.ts +0 -5
- package/dist/client/components/Body.js +0 -10
- package/dist/client/components/Document/context.d.ts +0 -3
- package/dist/client/components/Document/context.js +0 -14
- package/dist/client/components/Document/index.d.ts +0 -8
- package/dist/client/components/Document/index.js +0 -6
- package/dist/client/components/Head copy.d.ts +0 -5
- package/dist/client/components/Head copy.js +0 -8
- package/dist/client/components/Head.d.ts +0 -5
- package/dist/client/components/Head.js +0 -10
- package/dist/client/components/Link.d.ts +0 -6
- package/dist/client/components/Link.js +0 -10
- package/dist/client/refresh.d.ts +0 -7
- package/dist/client/refresh.js +0 -15
- package/dist/components/Document/Document.d.ts +0 -16
- package/dist/components/Document/Document.js +0 -15
- package/dist/components/DocumentContext/DocumentContext.d.ts +0 -15
- package/dist/components/DocumentContext/DocumentContext.js +0 -18
- package/dist/components/DocumentContext/context.d.ts +0 -11
- package/dist/components/DocumentContext/context.js +0 -14
- package/dist/components/DocumentContext/index.d.ts +0 -15
- package/dist/components/DocumentContext/index.js +0 -18
- package/dist/components/DocumentProvider.d.ts +0 -13
- package/dist/components/DocumentProvider.js +0 -7
- package/dist/document/Document/Document.d.ts +0 -7
- package/dist/document/Document/Document.js +0 -10
- package/dist/document/Document/context.d.ts +0 -17
- package/dist/document/Document/context.js +0 -13
- package/dist/document/Document/index.d.ts +0 -7
- package/dist/document/Document/index.js +0 -10
- package/dist/document/context.d.ts +0 -17
- package/dist/document/context.js +0 -13
- package/dist/loader.d.ts +0 -11
- package/dist/loader.js +0 -16
- package/dist/router/useSearchParams .d.ts +0 -9
- package/dist/router/useSearchParams .js +0 -50
package/dist/utils/index.js
CHANGED
|
@@ -1,27 +1 @@
|
|
|
1
|
-
|
|
2
|
-
if (typeof window === "undefined") {
|
|
3
|
-
return globalThis;
|
|
4
|
-
}
|
|
5
|
-
else {
|
|
6
|
-
return window;
|
|
7
|
-
}
|
|
8
|
-
};
|
|
9
|
-
export const getGlobalXanix = () => {
|
|
10
|
-
const global = getGlobal();
|
|
11
|
-
global.Xanix = global.Xanix || {};
|
|
12
|
-
return global.Xanix;
|
|
13
|
-
};
|
|
14
|
-
export const getDocumentData = () => {
|
|
15
|
-
const global = getGlobal();
|
|
16
|
-
global.DocumentData = global.DocumentData || {};
|
|
17
|
-
return global.DocumentData;
|
|
18
|
-
};
|
|
19
|
-
import fs from "node:fs";
|
|
20
|
-
import path from "node:path";
|
|
21
|
-
export const getDocumentFile = async () => {
|
|
22
|
-
const documentEntry = path.join(process.cwd(), ".xanix", "xanix-document.js");
|
|
23
|
-
if (fs.existsSync(documentEntry)) {
|
|
24
|
-
return documentEntry;
|
|
25
|
-
}
|
|
26
|
-
throw new Error(`Document file not found at ${documentEntry}`);
|
|
27
|
-
};
|
|
1
|
+
"use strict";
|
package/dist/xanix.js
CHANGED
|
@@ -19,18 +19,18 @@ const xanix = () => {
|
|
|
19
19
|
else {
|
|
20
20
|
const html = renderToString(component);
|
|
21
21
|
res.setHeader("Content-Type", "text/html");
|
|
22
|
-
originalSend(`
|
|
23
|
-
<!doctype html>
|
|
24
|
-
<html>
|
|
25
|
-
<head>
|
|
26
|
-
</head>
|
|
27
|
-
<body>
|
|
28
|
-
<div>${html}</div>
|
|
29
|
-
<script>
|
|
30
|
-
window.__INITIAL_PROPS__ = ${JSON.stringify(component.props)};
|
|
31
|
-
</script>
|
|
32
|
-
</body>
|
|
33
|
-
</html>
|
|
22
|
+
originalSend(`
|
|
23
|
+
<!doctype html>
|
|
24
|
+
<html>
|
|
25
|
+
<head>
|
|
26
|
+
</head>
|
|
27
|
+
<body>
|
|
28
|
+
<div>${html}</div>
|
|
29
|
+
<script>
|
|
30
|
+
window.__INITIAL_PROPS__ = ${JSON.stringify(component.props)};
|
|
31
|
+
</script>
|
|
32
|
+
</body>
|
|
33
|
+
</html>
|
|
34
34
|
`);
|
|
35
35
|
}
|
|
36
36
|
};
|
package/package.json
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "xanix",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.js",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
|
-
"bin": "./dist/bin/index.js",
|
|
9
|
-
"type": "module",
|
|
10
|
-
"files": [
|
|
11
|
-
"dist",
|
|
12
|
-
"
|
|
13
|
-
],
|
|
14
|
-
"exports": {
|
|
15
|
-
".": {
|
|
16
|
-
"import": "./dist/index.js",
|
|
17
|
-
"require": "./dist/index.js"
|
|
18
|
-
},
|
|
19
|
-
"./page": {
|
|
20
|
-
"import": "./dist/server/page.js",
|
|
21
|
-
"require": "./dist/server/page.js"
|
|
22
|
-
},
|
|
23
|
-
"./runtime": {
|
|
24
|
-
"import": "./dist/server/runtime/index.js",
|
|
25
|
-
"require": "./dist/server/runtime/index.js"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"scripts": {
|
|
29
|
-
"dev": "tsc --watch --preserveWatchOutput",
|
|
30
|
-
"build": "tsc",
|
|
31
|
-
"start": "node dist/index.js"
|
|
32
|
-
},
|
|
33
|
-
"keywords": [],
|
|
34
|
-
"author": "Naxrul Ahmed",
|
|
35
|
-
"license": "ISC",
|
|
36
|
-
"dependencies": {
|
|
37
|
-
"@babel/generator": "^8.0.0",
|
|
38
|
-
"@babel/parser": "^8.0.4",
|
|
39
|
-
"@babel/traverse": "^8.0.4",
|
|
40
|
-
"@rollup/plugin-alias": "^6.0.0",
|
|
41
|
-
"@rollup/plugin-commonjs": "^29.0.3",
|
|
42
|
-
"@rollup/plugin-json": "^6.1.0",
|
|
43
|
-
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
44
|
-
"@rollup/plugin-replace": "^6.0.3",
|
|
45
|
-
"@rollup/plugin-url": "^8.0.2",
|
|
46
|
-
"commander": "^15.0.0",
|
|
47
|
-
"dotenv": "^17.4.2",
|
|
48
|
-
"esbuild": "^0.28.2",
|
|
49
|
-
"express": "^5.2.1",
|
|
50
|
-
"picocolors": "^1.1.1",
|
|
51
|
-
"react-refresh": "^0.18.0",
|
|
52
|
-
"rollup": "^4.62.5",
|
|
53
|
-
"rollup-plugin-esbuild": "^6.2.1",
|
|
54
|
-
"tslib": "^2.8.1",
|
|
55
|
-
"ws": "^8.21.3"
|
|
56
|
-
},
|
|
57
|
-
"devDependencies": {
|
|
58
|
-
"@types/babel__core": "^7.20.5",
|
|
59
|
-
"@types/express": "^5.0.6",
|
|
60
|
-
"@types/node": "^26.2.0",
|
|
61
|
-
"@types/prompts": "^2.4.9",
|
|
62
|
-
"@types/react": "^19.2.17",
|
|
63
|
-
"@types/react-dom": "^19.2.3",
|
|
64
|
-
"@types/react-refresh": "^0.14.7",
|
|
65
|
-
"@types/ws": "^8.18.1",
|
|
66
|
-
"@xanui/core": "^1.3.38",
|
|
67
|
-
"@xanui/icons": "^1.1.14",
|
|
68
|
-
"@xanui/ui": "^1.2.24",
|
|
69
|
-
"react": "^19.2.8",
|
|
70
|
-
"react-dom": "^19.2.8",
|
|
71
|
-
"typescript": "^5.9.3"
|
|
72
|
-
}
|
|
73
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "xanix",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": "./dist/bin/index.js",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"xanix-env.d.ts"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"require": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./page": {
|
|
20
|
+
"import": "./dist/server/page.js",
|
|
21
|
+
"require": "./dist/server/page.js"
|
|
22
|
+
},
|
|
23
|
+
"./runtime": {
|
|
24
|
+
"import": "./dist/server/runtime/index.js",
|
|
25
|
+
"require": "./dist/server/runtime/index.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"dev": "tsc --watch --preserveWatchOutput",
|
|
30
|
+
"build": "tsc",
|
|
31
|
+
"start": "node dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [],
|
|
34
|
+
"author": "Naxrul Ahmed",
|
|
35
|
+
"license": "ISC",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@babel/generator": "^8.0.0",
|
|
38
|
+
"@babel/parser": "^8.0.4",
|
|
39
|
+
"@babel/traverse": "^8.0.4",
|
|
40
|
+
"@rollup/plugin-alias": "^6.0.0",
|
|
41
|
+
"@rollup/plugin-commonjs": "^29.0.3",
|
|
42
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
43
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
44
|
+
"@rollup/plugin-replace": "^6.0.3",
|
|
45
|
+
"@rollup/plugin-url": "^8.0.2",
|
|
46
|
+
"commander": "^15.0.0",
|
|
47
|
+
"dotenv": "^17.4.2",
|
|
48
|
+
"esbuild": "^0.28.2",
|
|
49
|
+
"express": "^5.2.1",
|
|
50
|
+
"picocolors": "^1.1.1",
|
|
51
|
+
"react-refresh": "^0.18.0",
|
|
52
|
+
"rollup": "^4.62.5",
|
|
53
|
+
"rollup-plugin-esbuild": "^6.2.1",
|
|
54
|
+
"tslib": "^2.8.1",
|
|
55
|
+
"ws": "^8.21.3"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@types/babel__core": "^7.20.5",
|
|
59
|
+
"@types/express": "^5.0.6",
|
|
60
|
+
"@types/node": "^26.2.0",
|
|
61
|
+
"@types/prompts": "^2.4.9",
|
|
62
|
+
"@types/react": "^19.2.17",
|
|
63
|
+
"@types/react-dom": "^19.2.3",
|
|
64
|
+
"@types/react-refresh": "^0.14.7",
|
|
65
|
+
"@types/ws": "^8.18.1",
|
|
66
|
+
"@xanui/core": "^1.3.38",
|
|
67
|
+
"@xanui/icons": "^1.1.14",
|
|
68
|
+
"@xanui/ui": "^1.2.24",
|
|
69
|
+
"react": "^19.2.8",
|
|
70
|
+
"react-dom": "^19.2.8",
|
|
71
|
+
"typescript": "^5.9.3"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import "express";
|
|
2
|
-
|
|
3
|
-
declare global {
|
|
4
|
-
const __XANIX_CLIENT__: boolean;
|
|
5
|
-
const __XANIX_SERVER__: boolean;
|
|
6
|
-
const __XANIX_DEV__: boolean;
|
|
7
|
-
const __XANIX_PROD__: boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
declare module "express-serve-static-core" {
|
|
11
|
-
interface Request {
|
|
12
|
-
page: {
|
|
13
|
-
setTitle(title: string): void;
|
|
14
|
-
setMeta(name: string, content: string): void;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
declare module "*.png" {
|
|
20
|
-
const src: string;
|
|
21
|
-
export default src;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
declare module "*.jpg" {
|
|
25
|
-
const src: string;
|
|
26
|
-
export default src;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
declare module "*.jpeg" {
|
|
30
|
-
const src: string;
|
|
31
|
-
export default src;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
declare module "*.gif" {
|
|
35
|
-
const src: string;
|
|
36
|
-
export default src;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
declare module "*.webp" {
|
|
40
|
-
const src: string;
|
|
41
|
-
export default src;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
declare module "*.svg" {
|
|
45
|
-
const src: string;
|
|
46
|
-
export default src;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
declare module "*.ico" {
|
|
50
|
-
const src: string;
|
|
51
|
-
export default src;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
declare module "*.woff" {
|
|
55
|
-
const src: string;
|
|
56
|
-
export default src;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
declare module "*.woff2" {
|
|
60
|
-
const src: string;
|
|
61
|
-
export default src;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
declare module "*.ttf" {
|
|
65
|
-
const src: string;
|
|
66
|
-
export default src;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
declare module "*.eot" {
|
|
70
|
-
const src: string;
|
|
71
|
-
export default src;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
declare module "*.css" {
|
|
75
|
-
const src: string;
|
|
76
|
-
export default src;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export {};
|
|
1
|
+
import "express";
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
const __XANIX_CLIENT__: boolean;
|
|
5
|
+
const __XANIX_SERVER__: boolean;
|
|
6
|
+
const __XANIX_DEV__: boolean;
|
|
7
|
+
const __XANIX_PROD__: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare module "express-serve-static-core" {
|
|
11
|
+
interface Request {
|
|
12
|
+
page: {
|
|
13
|
+
setTitle(title: string): void;
|
|
14
|
+
setMeta(name: string, content: string): void;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare module "*.png" {
|
|
20
|
+
const src: string;
|
|
21
|
+
export default src;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare module "*.jpg" {
|
|
25
|
+
const src: string;
|
|
26
|
+
export default src;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare module "*.jpeg" {
|
|
30
|
+
const src: string;
|
|
31
|
+
export default src;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare module "*.gif" {
|
|
35
|
+
const src: string;
|
|
36
|
+
export default src;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare module "*.webp" {
|
|
40
|
+
const src: string;
|
|
41
|
+
export default src;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare module "*.svg" {
|
|
45
|
+
const src: string;
|
|
46
|
+
export default src;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare module "*.ico" {
|
|
50
|
+
const src: string;
|
|
51
|
+
export default src;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare module "*.woff" {
|
|
55
|
+
const src: string;
|
|
56
|
+
export default src;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
declare module "*.woff2" {
|
|
60
|
+
const src: string;
|
|
61
|
+
export default src;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare module "*.ttf" {
|
|
65
|
+
const src: string;
|
|
66
|
+
export default src;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
declare module "*.eot" {
|
|
70
|
+
const src: string;
|
|
71
|
+
export default src;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare module "*.css" {
|
|
75
|
+
const src: string;
|
|
76
|
+
export default src;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export {};
|
package/dist/Document.d.ts
DELETED
package/dist/Document.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import Head from "./components/Head.js";
|
|
3
|
-
import Body from "./components/Body.js";
|
|
4
|
-
const Document = ({ document, children }) => {
|
|
5
|
-
return (_jsxs(Document, { document: document, children: [_jsxs(Head, { children: [_jsx("meta", { charSet: "UTF-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1.0" })] }), _jsx(Body, { children: children })] }));
|
|
6
|
-
};
|
|
7
|
-
export default Document;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Plugin } from "rollup";
|
|
2
|
-
import { XanixClientEntry } from "../../types";
|
|
3
|
-
export type XanixWatchChangeOptions = {
|
|
4
|
-
onClientEntryChange?: (entry: string, entries: XanixClientEntry[]) => Promise<void>;
|
|
5
|
-
onServerChange?: (entry: string, entries: XanixClientEntry[]) => Promise<void>;
|
|
6
|
-
onClientChange?: (entry: string, entries: XanixClientEntry[]) => Promise<void>;
|
|
7
|
-
onChange?: (entry: string, event: "update" | "delete" | "create" | undefined) => void;
|
|
8
|
-
};
|
|
9
|
-
declare const XanixWatchChange: (entries: XanixClientEntry[], options: XanixWatchChangeOptions) => Plugin;
|
|
10
|
-
export default XanixWatchChange;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { createManifest, readManifest } from "../../include/manifest.js";
|
|
3
|
-
import generateClientEntries from "../generateClientEntries.js";
|
|
4
|
-
import { entriesEqual } from "../../include/entry.js";
|
|
5
|
-
const XanixWatchChange = (entries, options) => {
|
|
6
|
-
return {
|
|
7
|
-
name: "xanix-watch-server",
|
|
8
|
-
async watchChange(id, change) {
|
|
9
|
-
const entry = path.resolve(id).replaceAll("\\", "/");
|
|
10
|
-
const manifest = await readManifest();
|
|
11
|
-
if (!manifest)
|
|
12
|
-
return;
|
|
13
|
-
const isClientEntry = Array.from(manifest.entries.values()).find((e) => e.file === entry);
|
|
14
|
-
if (!isClientEntry) {
|
|
15
|
-
const entries = await generateClientEntries();
|
|
16
|
-
const isEqual = await entriesEqual(entries);
|
|
17
|
-
if (!isEqual) {
|
|
18
|
-
await createManifest(entries);
|
|
19
|
-
await options.onClientEntryChange?.(entry, entries);
|
|
20
|
-
}
|
|
21
|
-
await options.onServerChange?.(entry, entries);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
await options.onClientChange?.(entry, entries);
|
|
25
|
-
}
|
|
26
|
-
options.onChange?.(entry, change?.event);
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
export default XanixWatchChange;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Plugin } from "rollup";
|
|
2
|
-
import { XanixClientEntry } from "../../types";
|
|
3
|
-
export type XanixWatchChangeOptions = {
|
|
4
|
-
onClientEntryChange?: (entry: string, entries: XanixClientEntry[]) => Promise<void>;
|
|
5
|
-
onServerChange?: (entry: string, entries: XanixClientEntry[]) => Promise<void>;
|
|
6
|
-
onChange?: (entry: string, event: "update" | "delete" | "create" | undefined) => void;
|
|
7
|
-
};
|
|
8
|
-
declare const XanixWatchChange: (entries: XanixClientEntry[], options: XanixWatchChangeOptions) => Plugin;
|
|
9
|
-
export default XanixWatchChange;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { createManifest, readManifest } from "../../include/manifest.js";
|
|
3
|
-
import generateClientEntries from "../generateClientEntries.js";
|
|
4
|
-
import { entriesEqual } from "../../include/entry.js";
|
|
5
|
-
const XanixWatchChange = (entries, options) => {
|
|
6
|
-
return {
|
|
7
|
-
name: "xanix-watch-server",
|
|
8
|
-
async watchChange(id, change) {
|
|
9
|
-
const entry = path.resolve(id).replaceAll("\\", "/");
|
|
10
|
-
const manifest = await readManifest();
|
|
11
|
-
if (!manifest)
|
|
12
|
-
return;
|
|
13
|
-
const isClientEntry = Array.from(manifest.entries.values()).find((e) => e.file === entry);
|
|
14
|
-
if (!isClientEntry) {
|
|
15
|
-
const entries = await generateClientEntries();
|
|
16
|
-
const isEqual = await entriesEqual(entries);
|
|
17
|
-
if (!isEqual) {
|
|
18
|
-
await createManifest(entries);
|
|
19
|
-
await options.onClientEntryChange?.(entry, entries);
|
|
20
|
-
}
|
|
21
|
-
await options.onServerChange?.(entry, entries);
|
|
22
|
-
}
|
|
23
|
-
options.onChange?.(entry, change?.event);
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export default XanixWatchChange;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Plugin } from "rollup";
|
|
2
|
-
import { XanixClientEntry } from "../../types";
|
|
3
|
-
export type XanixWatchChangeClientOptions = {
|
|
4
|
-
onChange?: (entry: string, event: "update" | "delete" | "create" | undefined) => void;
|
|
5
|
-
};
|
|
6
|
-
declare const XanixWatchChangeClient: (entries: XanixClientEntry[], options: XanixWatchChangeClientOptions) => Plugin;
|
|
7
|
-
export default XanixWatchChangeClient;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { readManifest } from "../../include/manifest.js";
|
|
3
|
-
const XanixWatchChangeClient = (entries, options) => {
|
|
4
|
-
return {
|
|
5
|
-
name: "xanix-watch-client",
|
|
6
|
-
async watchChange(id, change) {
|
|
7
|
-
const entry = path.resolve(id).replaceAll("\\", "/");
|
|
8
|
-
const manifest = await readManifest();
|
|
9
|
-
if (!manifest)
|
|
10
|
-
return;
|
|
11
|
-
options.onChange?.(entry, change?.event);
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export default XanixWatchChangeClient;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import alias from "@rollup/plugin-alias";
|
|
4
|
-
/**
|
|
5
|
-
* Create Rollup aliases from tsconfig.json paths.
|
|
6
|
-
*/
|
|
7
|
-
export function xanixTsconfigAlias() {
|
|
8
|
-
const root = process.cwd();
|
|
9
|
-
const tsconfigPath = path.resolve(root, "tsconfig.json");
|
|
10
|
-
if (!fs.existsSync(tsconfigPath)) {
|
|
11
|
-
return {
|
|
12
|
-
name: "xanix-tsconfig-alias",
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
let tsconfig;
|
|
16
|
-
try {
|
|
17
|
-
const content = fs.readFileSync(tsconfigPath, "utf8");
|
|
18
|
-
tsconfig = JSON.parse(content);
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
throw new Error(`[xanix] Failed to read tsconfig.json: ${tsconfigPath}\n${String(error)}`);
|
|
22
|
-
}
|
|
23
|
-
const compilerOptions = tsconfig.compilerOptions ?? {};
|
|
24
|
-
const baseUrl = compilerOptions.baseUrl ?? ".";
|
|
25
|
-
const basePath = path.resolve(path.dirname(tsconfigPath), baseUrl);
|
|
26
|
-
const paths = compilerOptions.paths ?? {};
|
|
27
|
-
const entries = Object.entries(paths)
|
|
28
|
-
.map(([find, replacements]) => {
|
|
29
|
-
const replacement = replacements[0];
|
|
30
|
-
if (!replacement) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
const hasWildcard = find.includes("*");
|
|
34
|
-
if (hasWildcard) {
|
|
35
|
-
const findPrefix = find.replace(/\/?\*$/, "");
|
|
36
|
-
const replacementPrefix = replacement.replace(/\/?\*$/, "");
|
|
37
|
-
return {
|
|
38
|
-
find: new RegExp(`^${escapeRegExp(findPrefix)}\\/(.+)$`),
|
|
39
|
-
replacement: `${path.resolve(basePath, replacementPrefix)}/$1`,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
find,
|
|
44
|
-
replacement: path.resolve(basePath, replacement),
|
|
45
|
-
};
|
|
46
|
-
})
|
|
47
|
-
.filter((entry) => entry !== null);
|
|
48
|
-
return alias({
|
|
49
|
-
entries,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Escape a string for use inside RegExp.
|
|
54
|
-
*/
|
|
55
|
-
function escapeRegExp(value) {
|
|
56
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
57
|
-
}
|