swift-rust 0.2.0
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 +78 -0
- package/bin/dev-server.mjs +1360 -0
- package/bin/error-overlay.mjs +529 -0
- package/bin/runtime/hmr-client.js +77 -0
- package/bin/swift-rust.js +96 -0
- package/dist/env.d.ts +4 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +3 -0
- package/dist/env.js.map +1 -0
- package/dist/font-google.d.ts +2 -0
- package/dist/font-google.d.ts.map +1 -0
- package/dist/font-google.js +2 -0
- package/dist/font-google.js.map +1 -0
- package/dist/font-local.d.ts +3 -0
- package/dist/font-local.d.ts.map +1 -0
- package/dist/font-local.js +2 -0
- package/dist/font-local.js.map +1 -0
- package/dist/font.d.ts +3 -0
- package/dist/font.d.ts.map +1 -0
- package/dist/font.js +2 -0
- package/dist/font.js.map +1 -0
- package/dist/head.d.ts +21 -0
- package/dist/head.d.ts.map +1 -0
- package/dist/head.jsx +15 -0
- package/dist/head.jsx.map +1 -0
- package/dist/image.d.ts +3 -0
- package/dist/image.d.ts.map +1 -0
- package/dist/image.js +2 -0
- package/dist/image.js.map +1 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/link.d.ts +10 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/link.jsx +6 -0
- package/dist/link.jsx.map +1 -0
- package/dist/pdf.d.ts +3 -0
- package/dist/pdf.d.ts.map +1 -0
- package/dist/pdf.js +2 -0
- package/dist/pdf.js.map +1 -0
- package/dist/router.d.ts +30 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +29 -0
- package/dist/router.js.map +1 -0
- package/dist/smoke.test.d.ts +2 -0
- package/dist/smoke.test.d.ts.map +1 -0
- package/dist/smoke.test.js +6 -0
- package/dist/smoke.test.js.map +1 -0
- package/dist/video.d.ts +4 -0
- package/dist/video.d.ts.map +1 -0
- package/dist/video.js +3 -0
- package/dist/video.js.map +1 -0
- package/package.json +127 -0
- package/scripts/package-native.ts +113 -0
- package/scripts/postinstall.js +151 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC7E,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/env.js
ADDED
package/dist/env.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7E,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-google.d.ts","sourceRoot":"","sources":["../src/font-google.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-google.js","sourceRoot":"","sources":["../src/font-google.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-local.d.ts","sourceRoot":"","sources":["../src/font-local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-local.js","sourceRoot":"","sources":["../src/font-local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/font.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { FontOptions, FontSubset, FontDisplay, FontWeight, FontStyle, LoadedFont, LocalFontOptions, LocalFontSource, } from "@swift-rust/font";
|
|
2
|
+
export { normalizeClassName, buildCssVariable, localFont, Lausanne, DxSlight, DxSlightMediumUltra, DxSlightExtBdUltraSlant, VarentGrotesk, VarentGroteskBold, VarentGroteskExtLtIta, Zimula, ALL_LOCAL_FONTS, ALL_LOCAL_FONT_PATHS, localFontCss, LAUSANNE_PATHS, DX_SLIGHT_PATHS, VARENT_PATHS, ZIMULA_PATHS, } from "@swift-rust/font";
|
|
3
|
+
//# sourceMappingURL=font.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font.d.ts","sourceRoot":"","sources":["../src/font.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,mBAAmB,EACnB,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,MAAM,EACN,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,GACb,MAAM,kBAAkB,CAAC"}
|
package/dist/font.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { normalizeClassName, buildCssVariable, localFont, Lausanne, DxSlight, DxSlightMediumUltra, DxSlightExtBdUltraSlant, VarentGrotesk, VarentGroteskBold, VarentGroteskExtLtIta, Zimula, ALL_LOCAL_FONTS, ALL_LOCAL_FONT_PATHS, localFontCss, LAUSANNE_PATHS, DX_SLIGHT_PATHS, VARENT_PATHS, ZIMULA_PATHS, } from "@swift-rust/font";
|
|
2
|
+
//# sourceMappingURL=font.js.map
|
package/dist/font.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font.js","sourceRoot":"","sources":["../src/font.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,mBAAmB,EACnB,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,MAAM,EACN,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,GACb,MAAM,kBAAkB,CAAC"}
|
package/dist/head.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface HeadProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
image?: string;
|
|
7
|
+
url?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function Head({ children }: HeadProps): ReactNode;
|
|
10
|
+
export declare function Title({ children }: {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
export declare function Meta({ name, content, property, }: {
|
|
14
|
+
name?: string;
|
|
15
|
+
property?: string;
|
|
16
|
+
content: string;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
18
|
+
export declare function Style({ children }: {
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=head.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"head.d.ts","sourceRoot":"","sources":["../src/head.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,SAAS,aAE3C;AAED,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAE1D;AAED,wBAAgB,IAAI,CAAC,EACnB,IAAI,EACJ,OAAO,EACP,QAAQ,GACT,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,+BAMA;AAED,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAK1D"}
|
package/dist/head.jsx
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function Head({ children }) {
|
|
2
|
+
return children;
|
|
3
|
+
}
|
|
4
|
+
export function Title({ children }) {
|
|
5
|
+
return <title>{children}</title>;
|
|
6
|
+
}
|
|
7
|
+
export function Meta({ name, content, property, }) {
|
|
8
|
+
return name ? (<meta name={name} content={content}/>) : (<meta property={property} content={content}/>);
|
|
9
|
+
}
|
|
10
|
+
export function Style({ children }) {
|
|
11
|
+
return (
|
|
12
|
+
// biome-ignore lint/security/noDangerouslySetInnerHtml: <style> contents are static CSS at build time
|
|
13
|
+
<style dangerouslySetInnerHTML={{ __html: typeof children === "string" ? children : "" }}/>);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=head.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"head.jsx","sourceRoot":"","sources":["../src/head.tsx"],"names":[],"mappings":"AAUA,MAAM,UAAU,IAAI,CAAC,EAAE,QAAQ,EAAa;IAC1C,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,EAAE,QAAQ,EAA2B;IACzD,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,EACnB,IAAI,EACJ,OAAO,EACP,QAAQ,GAKT;IACC,OAAO,IAAI,CAAC,CAAC,CAAC,CACZ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAG,CACvC,CAAC,CAAC,CAAC,CACF,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAG,CAC/C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,EAAE,QAAQ,EAA2B;IACzD,OAAO;IACL,sGAAsG;IACtG,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAG,CAC7F,CAAC;AACJ,CAAC"}
|
package/dist/image.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../src/image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/image.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../src/image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export type RenderingMode = "ssr" | "ssr-wasm" | "ssr-htmx" | "wasm";
|
|
2
|
+
export interface ImageConfig {
|
|
3
|
+
domains?: string[];
|
|
4
|
+
formats?: string[];
|
|
5
|
+
deviceSizes?: number[];
|
|
6
|
+
imageSizes?: number[];
|
|
7
|
+
minimumCacheTTL?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface FontConfig {
|
|
10
|
+
subsets?: string[];
|
|
11
|
+
display?: "auto" | "block" | "swap" | "fallback" | "optional";
|
|
12
|
+
preload?: boolean;
|
|
13
|
+
adjustFontFallback?: boolean;
|
|
14
|
+
fallback?: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface PdfConfig {
|
|
17
|
+
defaultPageSize?: "A4" | "A3" | "Letter" | "Legal" | "Tabloid";
|
|
18
|
+
defaultOrientation?: "portrait" | "landscape";
|
|
19
|
+
compress?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface SwiftRustConfig {
|
|
22
|
+
rendering?: RenderingMode;
|
|
23
|
+
image?: ImageConfig;
|
|
24
|
+
font?: FontConfig;
|
|
25
|
+
pdf?: PdfConfig;
|
|
26
|
+
}
|
|
27
|
+
export declare function defineConfig(config: SwiftRustConfig): SwiftRustConfig;
|
|
28
|
+
export type Metadata = {
|
|
29
|
+
title?: string | {
|
|
30
|
+
template: string;
|
|
31
|
+
default: string;
|
|
32
|
+
};
|
|
33
|
+
description?: string;
|
|
34
|
+
openGraph?: {
|
|
35
|
+
title?: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
type?: string;
|
|
38
|
+
url?: string;
|
|
39
|
+
images?: Array<{
|
|
40
|
+
url: string;
|
|
41
|
+
width?: number;
|
|
42
|
+
height?: number;
|
|
43
|
+
alt?: string;
|
|
44
|
+
}>;
|
|
45
|
+
};
|
|
46
|
+
twitter?: {
|
|
47
|
+
card?: "summary" | "summary_large_image";
|
|
48
|
+
title?: string;
|
|
49
|
+
description?: string;
|
|
50
|
+
images?: string[];
|
|
51
|
+
};
|
|
52
|
+
robots?: {
|
|
53
|
+
index?: boolean;
|
|
54
|
+
follow?: boolean;
|
|
55
|
+
};
|
|
56
|
+
alternates?: {
|
|
57
|
+
canonical?: string;
|
|
58
|
+
};
|
|
59
|
+
icons?: {
|
|
60
|
+
icon?: string;
|
|
61
|
+
apple?: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export type { ImageProps, ImageFormat } from "@swift-rust/image";
|
|
65
|
+
export { Image } from "@swift-rust/image";
|
|
66
|
+
export type { FontOptions, FontSubset, FontDisplay, FontWeight, FontStyle, LoadedFont, LocalFontOptions, LocalFontSource, } from "@swift-rust/font";
|
|
67
|
+
export { localFont, Lausanne, DxSlight, DxSlightMediumUltra, DxSlightExtBdUltraSlant, VarentGrotesk, VarentGroteskBold, VarentGroteskExtLtIta, Zimula, ALL_LOCAL_FONTS, ALL_LOCAL_FONT_PATHS, localFontCss, LAUSANNE_PATHS, DX_SLIGHT_PATHS, VARENT_PATHS, ZIMULA_PATHS, } from "@swift-rust/font";
|
|
68
|
+
export type { DocumentProps, PageProps as PdfPageProps, TextProps, ViewProps, PageSize, Orientation, } from "@swift-rust/pdf";
|
|
69
|
+
export { Document, Page, Text, View } from "@swift-rust/pdf";
|
|
70
|
+
export type { LayoutProps, PageProps, RouteHandler, RouteHandlerContext } from "./router";
|
|
71
|
+
export type { HeadProps as MetaHeadProps } from "./head";
|
|
72
|
+
export type { LinkProps as LinkComponentProps } from "./link";
|
|
73
|
+
export { Link } from "./link";
|
|
74
|
+
export { Head, Title, Meta, Style } from "./head";
|
|
75
|
+
export { notFound, redirect, permanentRedirect } from "./router";
|
|
76
|
+
export { NotFoundError, RedirectError } from "./router";
|
|
77
|
+
export { Video, BackgroundVideo, VideoLightbox, isYouTubeUrl, isVimeoUrl, getYouTubeId, getVimeoId, detectProvider, getYouTubeEmbedUrl, getVimeoEmbedUrl, } from "./video";
|
|
78
|
+
export type { VideoProps, VideoSource, VideoCaption, VideoPreload, VideoProvider, BackgroundVideoProps, VideoLightboxProps, } from "./video";
|
|
79
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;AAErE,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;IAC9D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,eAAe,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;IAC/D,kBAAkB,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,CAErE;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB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/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function defineConfig(config) {
|
|
2
|
+
return config;
|
|
3
|
+
}
|
|
4
|
+
export { Image } from "@swift-rust/image";
|
|
5
|
+
export { localFont, Lausanne, DxSlight, DxSlightMediumUltra, DxSlightExtBdUltraSlant, VarentGrotesk, VarentGroteskBold, VarentGroteskExtLtIta, Zimula, ALL_LOCAL_FONTS, ALL_LOCAL_FONT_PATHS, localFontCss, LAUSANNE_PATHS, DX_SLIGHT_PATHS, VARENT_PATHS, ZIMULA_PATHS, } from "@swift-rust/font";
|
|
6
|
+
export { Document, Page, Text, View } from "@swift-rust/pdf";
|
|
7
|
+
export { Link } from "./link";
|
|
8
|
+
export { Head, Title, Meta, Style } from "./head";
|
|
9
|
+
export { notFound, redirect, permanentRedirect } from "./router";
|
|
10
|
+
export { NotFoundError, RedirectError } from "./router";
|
|
11
|
+
export { Video, BackgroundVideo, VideoLightbox, isYouTubeUrl, isVimeoUrl, getYouTubeId, getVimeoId, detectProvider, getYouTubeEmbedUrl, getVimeoEmbedUrl, } from "./video";
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA+BA,MAAM,UAAU,YAAY,CAAC,MAAuB;IAClD,OAAO,MAAM,CAAC;AAChB,CAAC;AAwBD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAW1C,OAAO,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,mBAAmB,EACnB,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,MAAM,EACN,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,GACb,MAAM,kBAAkB,CAAC;AAS1B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAI7D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EACL,KAAK,EACL,eAAe,EACf,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
|
package/dist/link.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AnchorHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export interface LinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "href"> {
|
|
3
|
+
href: string;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
prefetch?: boolean;
|
|
6
|
+
replace?: boolean;
|
|
7
|
+
scroll?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function Link({ href, prefetch: _prefetch, replace: _replace, scroll: _scroll, children, ...rest }: LinkProps): import("react").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7D,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACtF,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,IAAI,CAAC,EACnB,IAAI,EACJ,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,QAAQ,EACjB,MAAM,EAAE,OAAO,EACf,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,SAAS,+BAMX"}
|
package/dist/link.jsx
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.jsx","sourceRoot":"","sources":["../src/link.tsx"],"names":[],"mappings":"AAUA,MAAM,UAAU,IAAI,CAAC,EACnB,IAAI,EACJ,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,QAAQ,EACjB,MAAM,EAAE,OAAO,EACf,QAAQ,EACR,GAAG,IAAI,EACG;IACV,OAAO,CACL,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CACtB;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,CAAC,CAAC,CACL,CAAC;AACJ,CAAC"}
|
package/dist/pdf.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Document, Page, Text, View, Pdf, PdfError } from "@swift-rust/pdf";
|
|
2
|
+
export type { DocumentProps, PageProps, TextProps, ViewProps, PageSize, Orientation, PdfNode, PdfProps, PdfSource, PdfScale, PdfErrorKind, PdfLoadInfo, } from "@swift-rust/pdf";
|
|
3
|
+
//# sourceMappingURL=pdf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf.d.ts","sourceRoot":"","sources":["../src/pdf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC5E,YAAY,EACV,aAAa,EACb,SAAS,EACT,SAAS,EACT,SAAS,EACT,QAAQ,EACR,WAAW,EACX,OAAO,EACP,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,WAAW,GACZ,MAAM,iBAAiB,CAAC"}
|
package/dist/pdf.js
ADDED
package/dist/pdf.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf.js","sourceRoot":"","sources":["../src/pdf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/router.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface LayoutProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export interface PageProps<P = Record<string, string>> {
|
|
6
|
+
params: P;
|
|
7
|
+
searchParams: Record<string, string | string[]>;
|
|
8
|
+
}
|
|
9
|
+
export interface RouteHandlerContext<P = Record<string, string>> {
|
|
10
|
+
params: P;
|
|
11
|
+
searchParams: Record<string, string | string[]>;
|
|
12
|
+
request: Request;
|
|
13
|
+
query: Record<string, string>;
|
|
14
|
+
body: unknown;
|
|
15
|
+
}
|
|
16
|
+
export type RouteHandler<P = Record<string, string>> = (context: RouteHandlerContext<P>) => Response | Promise<Response>;
|
|
17
|
+
export declare class NotFoundError extends Error {
|
|
18
|
+
readonly digest = "NOT_FOUND";
|
|
19
|
+
constructor(message?: string);
|
|
20
|
+
}
|
|
21
|
+
export declare function notFound(message?: string): never;
|
|
22
|
+
export declare class RedirectError extends Error {
|
|
23
|
+
readonly digest: string;
|
|
24
|
+
readonly status: number;
|
|
25
|
+
readonly location: string;
|
|
26
|
+
constructor(location: string, status?: number);
|
|
27
|
+
}
|
|
28
|
+
export declare function redirect(location: string, status?: 307 | 308 | 302 | 303): never;
|
|
29
|
+
export declare function permanentRedirect(location: string): never;
|
|
30
|
+
//# sourceMappingURL=router.d.ts.map
|
|
@@ -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AM,EAAE,MAAM,SAAM;CAO3C;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAS,GAAG,KAAK,CAErF;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAEzD"}
|
package/dist/router.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export class NotFoundError extends Error {
|
|
2
|
+
digest = "NOT_FOUND";
|
|
3
|
+
constructor(message = "Not found") {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = "NotFoundError";
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export function notFound(message) {
|
|
9
|
+
throw new NotFoundError(message);
|
|
10
|
+
}
|
|
11
|
+
export class RedirectError extends Error {
|
|
12
|
+
digest;
|
|
13
|
+
status;
|
|
14
|
+
location;
|
|
15
|
+
constructor(location, status = 307) {
|
|
16
|
+
super(`Redirect to ${location}`);
|
|
17
|
+
this.name = "RedirectError";
|
|
18
|
+
this.digest = `REDIRECT;${status};${location}`;
|
|
19
|
+
this.status = status;
|
|
20
|
+
this.location = location;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function redirect(location, status = 307) {
|
|
24
|
+
throw new RedirectError(location, status);
|
|
25
|
+
}
|
|
26
|
+
export function permanentRedirect(location) {
|
|
27
|
+
throw new RedirectError(location, 308);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAuBA,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,MAAM,GAAG,WAAW,CAAC;IAC9B,YAAY,OAAO,GAAG,WAAW;QAC/B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED,MAAM,UAAU,QAAQ,CAAC,OAAgB;IACvC,MAAM,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,MAAM,CAAS;IACf,MAAM,CAAS;IACf,QAAQ,CAAS;IAC1B,YAAY,QAAgB,EAAE,MAAM,GAAG,GAAG;QACxC,KAAK,CAAC,eAAe,QAAQ,EAAE,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,YAAY,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC/C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAED,MAAM,UAAU,QAAQ,CAAC,QAAgB,EAAE,SAAgC,GAAG;IAC5E,MAAM,IAAI,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAChD,MAAM,IAAI,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smoke.test.d.ts","sourceRoot":"","sources":["../src/smoke.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smoke.test.js","sourceRoot":"","sources":["../src/smoke.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAE/B,IAAI,CAAC,2CAA2C,EAAE,GAAG,EAAE;IACrD,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AAC5B,CAAC,CAAC,CAAC"}
|
package/dist/video.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Video, BackgroundVideo, VideoLightbox, VideoError, default } from "@swift-rust/video";
|
|
2
|
+
export { isYouTubeUrl, isVimeoUrl, getYouTubeId, getVimeoId, detectProvider, getYouTubeEmbedUrl, getVimeoEmbedUrl, } from "@swift-rust/video";
|
|
3
|
+
export type { VideoProps, VideoSource, VideoCaption, VideoPreload, VideoProvider, VideoErrorCode, BackgroundVideoProps, VideoLightboxProps, } from "@swift-rust/video";
|
|
4
|
+
//# sourceMappingURL=video.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../src/video.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC/F,OAAO,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC"}
|
package/dist/video.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Video, BackgroundVideo, VideoLightbox, VideoError, default } from "@swift-rust/video";
|
|
2
|
+
export { isYouTubeUrl, isVimeoUrl, getYouTubeId, getVimeoId, detectProvider, getYouTubeEmbedUrl, getVimeoEmbedUrl, } from "@swift-rust/video";
|
|
3
|
+
//# sourceMappingURL=video.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video.js","sourceRoot":"","sources":["../src/video.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC/F,OAAO,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "swift-rust",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "The full-stack React framework powered with Rust + Bun. TSX-first, Rust rendering, 10x faster than Next.js, single binary deploy.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://swift-rust.dev",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/swift-rust/swift-rust.git",
|
|
10
|
+
"directory": "packages/swift-rust"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"swift-rust",
|
|
14
|
+
"framework",
|
|
15
|
+
"rust",
|
|
16
|
+
"ssr",
|
|
17
|
+
"react"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"module": "./dist/index.js",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"import": "./dist/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./image": {
|
|
29
|
+
"types": "./dist/image.d.ts",
|
|
30
|
+
"import": "./dist/image.js"
|
|
31
|
+
},
|
|
32
|
+
"./font": {
|
|
33
|
+
"types": "./dist/font.d.ts",
|
|
34
|
+
"import": "./dist/font.js"
|
|
35
|
+
},
|
|
36
|
+
"./font/google": {
|
|
37
|
+
"types": "./dist/font-google.d.ts",
|
|
38
|
+
"import": "./dist/font-google.js"
|
|
39
|
+
},
|
|
40
|
+
"./font/local": {
|
|
41
|
+
"types": "./dist/font-local.d.ts",
|
|
42
|
+
"import": "./dist/font-local.js"
|
|
43
|
+
},
|
|
44
|
+
"./pdf": {
|
|
45
|
+
"types": "./dist/pdf.d.ts",
|
|
46
|
+
"import": "./dist/pdf.js"
|
|
47
|
+
},
|
|
48
|
+
"./env": {
|
|
49
|
+
"types": "./dist/env.d.ts",
|
|
50
|
+
"import": "./dist/env.js"
|
|
51
|
+
},
|
|
52
|
+
"./router": {
|
|
53
|
+
"types": "./dist/router.d.ts",
|
|
54
|
+
"import": "./dist/router.js"
|
|
55
|
+
},
|
|
56
|
+
"./head": {
|
|
57
|
+
"types": "./dist/head.d.ts",
|
|
58
|
+
"import": "./dist/head.js"
|
|
59
|
+
},
|
|
60
|
+
"./link": {
|
|
61
|
+
"types": "./dist/link.d.ts",
|
|
62
|
+
"import": "./dist/link.js"
|
|
63
|
+
},
|
|
64
|
+
"./video": {
|
|
65
|
+
"types": "./dist/video.d.ts",
|
|
66
|
+
"import": "./dist/video.js"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"bin": {
|
|
70
|
+
"swift-rust": "./bin/swift-rust.js"
|
|
71
|
+
},
|
|
72
|
+
"files": [
|
|
73
|
+
"dist",
|
|
74
|
+
"bin",
|
|
75
|
+
"scripts",
|
|
76
|
+
"native"
|
|
77
|
+
],
|
|
78
|
+
"scripts": {
|
|
79
|
+
"build": "tsc -p tsconfig.json",
|
|
80
|
+
"dev": "tsc -p tsconfig.json --watch",
|
|
81
|
+
"lint": "biome check --no-errors-on-unmatched $(pwd)/src",
|
|
82
|
+
"typecheck": "tsc --noEmit",
|
|
83
|
+
"test": "bun test",
|
|
84
|
+
"clean": "rm -rf dist .turbo native",
|
|
85
|
+
"prepublishOnly": "bun run build",
|
|
86
|
+
"postinstall": "node ./scripts/postinstall.js"
|
|
87
|
+
},
|
|
88
|
+
"dependencies": {
|
|
89
|
+
"@dotenvx/dotenvx": "^1.0.0",
|
|
90
|
+
"@swift-rust/env": "0.2.0",
|
|
91
|
+
"@swift-rust/font": "0.2.0",
|
|
92
|
+
"@swift-rust/image": "1.0.0",
|
|
93
|
+
"@swift-rust/pdf": "0.2.0",
|
|
94
|
+
"@swift-rust/video": "0.2.0",
|
|
95
|
+
"react": "^19.0.0",
|
|
96
|
+
"react-dom": "^19.0.0"
|
|
97
|
+
},
|
|
98
|
+
"peerDependencies": {
|
|
99
|
+
"react": "^18 || ^19",
|
|
100
|
+
"react-dom": "^18 || ^19"
|
|
101
|
+
},
|
|
102
|
+
"peerDependenciesMeta": {
|
|
103
|
+
"react": {
|
|
104
|
+
"optional": true
|
|
105
|
+
},
|
|
106
|
+
"react-dom": {
|
|
107
|
+
"optional": true
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"devDependencies": {
|
|
111
|
+
"@types/bun": "^1.1.0",
|
|
112
|
+
"@types/node": "^22.0.0",
|
|
113
|
+
"@types/react": "^19.0.0",
|
|
114
|
+
"@types/react-dom": "^19.0.0",
|
|
115
|
+
"typescript": "^6.0.0"
|
|
116
|
+
},
|
|
117
|
+
"engines": {
|
|
118
|
+
"node": ">=20.0.0",
|
|
119
|
+
"bun": ">=1.1.0"
|
|
120
|
+
},
|
|
121
|
+
"publishConfig": {
|
|
122
|
+
"access": "public"
|
|
123
|
+
},
|
|
124
|
+
"bugs": {
|
|
125
|
+
"url": "https://github.com/swift-rust/swift-rust/issues"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { execSync } from "node:child_process";
|
|
2
|
+
import { existsSync, mkdirSync, writeFileSync, statSync } from "node:fs";
|
|
3
|
+
import { join, resolve, dirname, basename } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const repoRoot = resolve(here, "../..");
|
|
8
|
+
const packageRoot = resolve(here, "..");
|
|
9
|
+
const outDir = join(packageRoot, "native");
|
|
10
|
+
|
|
11
|
+
interface Target {
|
|
12
|
+
triple: string;
|
|
13
|
+
platform: string;
|
|
14
|
+
ext: "tar.gz" | "zip";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const TARGETS: Target[] = [
|
|
18
|
+
{ triple: "x86_64-unknown-linux-gnu", platform: "linux-x64", ext: "tar.gz" },
|
|
19
|
+
{ triple: "x86_64-unknown-linux-musl", platform: "linux-x64-musl", ext: "tar.gz" },
|
|
20
|
+
{ triple: "aarch64-unknown-linux-musl", platform: "linux-arm64", ext: "tar.gz" },
|
|
21
|
+
{ triple: "x86_64-apple-darwin", platform: "darwin-x64", ext: "tar.gz" },
|
|
22
|
+
{ triple: "aarch64-apple-darwin", platform: "darwin-arm64", ext: "tar.gz" },
|
|
23
|
+
{ triple: "x86_64-pc-windows-msvc", platform: "win32-x64", ext: "zip" },
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
const HOST_TRIPLE = (() => {
|
|
27
|
+
const p = process.platform;
|
|
28
|
+
const a = process.arch;
|
|
29
|
+
if (p === "darwin" && a === "x64") return "x86_64-apple-darwin";
|
|
30
|
+
if (p === "darwin" && a === "arm64") return "aarch64-apple-darwin";
|
|
31
|
+
if (p === "linux" && a === "x64") return "x86_64-unknown-linux-gnu";
|
|
32
|
+
if (p === "linux" && a === "arm64") return "aarch64-unknown-linux-musl";
|
|
33
|
+
if (p === "win32" && a === "x64") return "x86_64-pc-windows-msvc";
|
|
34
|
+
return null;
|
|
35
|
+
})();
|
|
36
|
+
|
|
37
|
+
const buildAll = process.env.SWIFT_RUST_BUILD_ALL === "1";
|
|
38
|
+
|
|
39
|
+
function targetForCurrentHost(): Target | null {
|
|
40
|
+
return TARGETS.find((t) => t.triple === HOST_TRIPLE) ?? null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function build(target: Target) {
|
|
44
|
+
const args = ["build", "-p", "swift-rust", "--bin", "swift-rust", "--release", "--target", target.triple];
|
|
45
|
+
console.log(`→ cargo ${args.join(" ")}`);
|
|
46
|
+
execSync(`cargo ${args.join(" ")}`, { stdio: "inherit", cwd: repoRoot });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function archive(target: Target) {
|
|
50
|
+
const exe = target.platform.startsWith("win32") ? "swift-rust.exe" : "swift-rust";
|
|
51
|
+
const src = join(repoRoot, "target", target.triple, "release", exe);
|
|
52
|
+
if (!existsSync(src)) throw new Error(`built binary not found at ${src}`);
|
|
53
|
+
const out = join(outDir, `swift-rust-${target.triple}.${target.ext}`);
|
|
54
|
+
mkdirSync(outDir, { recursive: true });
|
|
55
|
+
if (target.ext === "tar.gz") {
|
|
56
|
+
const dir = dirname(src);
|
|
57
|
+
const base = basename(src);
|
|
58
|
+
execSync(`tar -C ${dir} -czf ${out} ${base}`);
|
|
59
|
+
} else {
|
|
60
|
+
execSync(`cd ${dirname(src)} && zip -j ${out} ${basename(src)}`);
|
|
61
|
+
}
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function generateManifest(version: string) {
|
|
66
|
+
const manifest: Record<string, { url: string; sha256: string; size: number }> = {};
|
|
67
|
+
for (const t of TARGETS) {
|
|
68
|
+
const file = `swift-rust-${t.triple}.${t.ext}`;
|
|
69
|
+
const full = join(outDir, file);
|
|
70
|
+
if (!existsSync(full)) continue;
|
|
71
|
+
const size = statSync(full).size;
|
|
72
|
+
const sha256 = execSync(`shasum -a 256 ${full}`).toString().split(" ")[0];
|
|
73
|
+
manifest[t.platform] = {
|
|
74
|
+
url: `https://github.com/swift-rust/swift-rust/releases/download/v${version}/${file}`,
|
|
75
|
+
sha256,
|
|
76
|
+
size,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
writeFileSync(join(outDir, "manifest.json"), `${JSON.stringify(manifest, null, 2)}\n`);
|
|
80
|
+
console.log(`→ wrote ${join(outDir, "manifest.json")}`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const version = process.env.SWIFT_RUST_VERSION ?? require("../package.json").version;
|
|
84
|
+
const targets = buildAll
|
|
85
|
+
? TARGETS
|
|
86
|
+
: (() => {
|
|
87
|
+
const host = targetForCurrentHost();
|
|
88
|
+
if (!host) {
|
|
89
|
+
console.log(`→ no host triple for ${process.platform}/${process.arch}, building nothing`);
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
console.log(`→ host ${process.platform}/${process.arch} → building only ${host.triple}`);
|
|
93
|
+
return [host];
|
|
94
|
+
})();
|
|
95
|
+
|
|
96
|
+
for (const t of targets) {
|
|
97
|
+
try {
|
|
98
|
+
build(t);
|
|
99
|
+
} catch (err) {
|
|
100
|
+
console.error(`✗ failed to build ${t.triple}: ${err.message ?? err}`);
|
|
101
|
+
process.exitCode = 1;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
for (const t of targets) {
|
|
105
|
+
try {
|
|
106
|
+
archive(t);
|
|
107
|
+
} catch (err) {
|
|
108
|
+
console.error(`✗ failed to archive ${t.triple}: ${err.message ?? err}`);
|
|
109
|
+
process.exitCode = 1;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
generateManifest(version);
|
|
113
|
+
console.log("done");
|