@savvy-web/bundler 2.1.30 → 2.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 CHANGED
@@ -326,7 +326,7 @@ That gives you `readonly __PACKAGE_VERSION__?: string` on `NodeJS.ProcessEnv`
326
326
  - **Build targets** — `dev` for local linking, `prod` for a resolved publishable manifest (which also emits an API Extractor api-model) and `exe` for SEA binaries, on disjoint `dist/dev` and `dist/prod` output paths for clean caching.
327
327
  - **Bundled declarations** — per-module JavaScript with a single rolled-up `.d.ts` per public entry, so re-exported types stay reachable through your published export subpaths.
328
328
  - **Ambient type exports** — a types-only `exports` entry backed by a hand-authored `.d.ts` (a bare string or `{ types }`) is copied verbatim into every target dir with its manifest pointer rewritten to a key-derived path, no custom `transform` or post-build copy needed; the declaration must be self-contained and may not be mixed with a runtime source.
329
- - **Shared tsconfig base** — extend `@savvy-web/bundler/ecma.json` for the ESNext/NodeNext/strict settings the build expects.
329
+ - **Shared tsconfig base** — extend `@savvy-web/bundler/tsconfig/ecma.json` for the ESNext/NodeNext/strict settings the build expects.
330
330
  - **Manifest resolution** — `catalog:` and `workspace:` specifiers are resolved against the workspace for the published target, and preserved for the linked dev target.
331
331
  - **Multi-target publishing** — a `publishConfig.targets` map publishes one package to several registries or under several names; `--target prod` builds the distinct byte variants and writes a `targets.json` binding for the release step.
332
332
  - **Executable binaries** — an `exe` config compiles SEA binaries from a bin entry via `@tsdown/exe`, inferring the platform from the package's `os`/`cpu` when targets are omitted.
Binary file
@@ -0,0 +1,92 @@
1
+ Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+ -----------------------------------------------------------
8
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
9
+ -----------------------------------------------------------
10
+
11
+ PREAMBLE
12
+ The goals of the Open Font License (OFL) are to stimulate worldwide
13
+ development of collaborative font projects, to support the font creation
14
+ efforts of academic and linguistic communities, and to provide a free and
15
+ open framework in which fonts may be shared and improved in partnership
16
+ with others.
17
+
18
+ The OFL allows the licensed fonts to be used, studied, modified and
19
+ redistributed freely as long as they are not sold by themselves. The
20
+ fonts, including any derivative works, can be bundled, embedded,
21
+ redistributed and/or sold with any software provided that any reserved
22
+ names are not used by derivative works. The fonts and derivatives,
23
+ however, cannot be released under any other type of license. The
24
+ requirement for fonts to remain under this license does not apply
25
+ to any document created using the fonts or their derivatives.
26
+
27
+ DEFINITIONS
28
+ "Font Software" refers to the set of files released by the Copyright
29
+ Holder(s) under this license and clearly marked as such. This may
30
+ include source files, build scripts and documentation.
31
+
32
+ "Reserved Font Name" refers to any names specified as such after the
33
+ copyright statement(s).
34
+
35
+ "Original Version" refers to the collection of Font Software components as
36
+ distributed by the Copyright Holder(s).
37
+
38
+ "Modified Version" refers to any derivative made by adding to, deleting,
39
+ or substituting -- in part or in whole -- any of the components of the
40
+ Original Version, by changing formats or by porting the Font Software to a
41
+ new environment.
42
+
43
+ "Author" refers to any designer, engineer, programmer, technical
44
+ writer or other person who contributed to the Font Software.
45
+
46
+ PERMISSION AND CONDITIONS
47
+ Permission is hereby granted, free of charge, to any person obtaining
48
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
49
+ redistribute, and sell modified and unmodified copies of the Font
50
+ Software, subject to the following conditions:
51
+
52
+ 1) Neither the Font Software nor any of its individual components,
53
+ in Original or Modified Versions, may be sold by itself.
54
+
55
+ 2) Original or Modified Versions of the Font Software may be bundled,
56
+ redistributed and/or sold with any software, provided that each copy
57
+ contains the above copyright notice and this license. These can be
58
+ included either as stand-alone text files, human-readable headers or
59
+ in the appropriate machine-readable metadata fields within text or
60
+ binary files as long as those fields can be easily viewed by the user.
61
+
62
+ 3) No Modified Version of the Font Software may use the Reserved Font
63
+ Name(s) unless explicit written permission is granted by the corresponding
64
+ Copyright Holder. This restriction only applies to the primary font name as
65
+ presented to the users.
66
+
67
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
68
+ Software shall not be used to promote, endorse or advertise any
69
+ Modified Version, except to acknowledge the contribution(s) of the
70
+ Copyright Holder(s) and the Author(s) or with their explicit written
71
+ permission.
72
+
73
+ 5) The Font Software, modified or unmodified, in part or in whole,
74
+ must be distributed entirely under this license, and must not be
75
+ distributed under any other license. The requirement for fonts to
76
+ remain under this license does not apply to any document created
77
+ using the Font Software.
78
+
79
+ TERMINATION
80
+ This license becomes null and void if any of the above conditions are
81
+ not met.
82
+
83
+ DISCLAIMER
84
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
85
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
86
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
87
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
88
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
89
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
90
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
91
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
92
+ OTHER DEALINGS IN THE FONT SOFTWARE.
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AmbientDtsEntry, BuildFormat, BuildPlatform, BuildReport, BuildTargetGroupsOptions, CssOptions, ExeConfig, GenerateMetaOptions, Json, JsxConfig, LooseFiles, MetaOptions, MetaResult, NextVersions, PublishTargets, RenderedOutput, RunExeBuildOptions, TargetGroupRef, TargetResolution, TsconfigJsx, defaultManifestTransform, extractAmbientDts } from "@savvy-web/tsdown-plugins";
1
+ import { AmbientDtsEntry, BuildFormat, BuildPlatform, BuildReport, BuildTargetGroupsOptions, CssOptions, ExeConfig, GenerateMetaOptions, Json, JsxConfig, LooseFiles, MetaOptions, MetaResult, NextVersions, OgImageInfo, PublishTargets, RenderedOutput, RunExeBuildOptions, TargetGroupRef, TargetResolution, TsconfigJsx, TsdoctorMetaOptions, defaultManifestTransform, extractAmbientDts } from "@savvy-web/tsdown-plugins";
2
2
  import { Plugin, Plugin as Plugin$1 } from "rolldown";
3
3
  //#region src/config.d.ts
4
4
  /** @public */
@@ -284,5 +284,5 @@ declare function runBuild(config: BuildConfig, options: RunOptions): Promise<voi
284
284
  */
285
285
  declare function build(input?: BuildConfigInput, overrides?: Partial<RunOptions>): Promise<void>;
286
286
  //#endregion
287
- export { type AmbientDtsEntry, type BuildConfig, type BuildConfigInput, type BuildEntryOverride, type OutputConfig, type ParsedArgs, type Plugin, type RunOptions, build, defaultManifestTransform, defineBuild, extractAmbientDts, parseArgs, runBuild };
287
+ export { type AmbientDtsEntry, type BuildConfig, type BuildConfigInput, type BuildEntryOverride, type OgImageInfo, type OutputConfig, type ParsedArgs, type Plugin, type RunOptions, type TsdoctorMetaOptions, build, defaultManifestTransform, defineBuild, extractAmbientDts, parseArgs, runBuild };
288
288
  //# sourceMappingURL=index.d.ts.map
package/og.d.ts ADDED
@@ -0,0 +1,39 @@
1
+ import { OgImageInfo } from "@savvy-web/tsdown-plugins";
2
+ //#region src/og.d.ts
3
+ /**
4
+ * Colors for the default Open Graph card.
5
+ *
6
+ * @public
7
+ */
8
+ interface SatoriOgOptions {
9
+ /** The project-name accent (CSS color). */
10
+ readonly accent?: string | undefined;
11
+ readonly background?: string | undefined;
12
+ readonly foreground?: string | undefined;
13
+ }
14
+ /**
15
+ * Build-time Open Graph image renderers for `meta.tsdoctor.openGraph.generate`.
16
+ *
17
+ * @remarks
18
+ * `satori()` returns the default card: project name, package name and version, tagline,
19
+ * 1200×630 PNG, rendered through the optional peers `satori` and `@resvg/resvg-js`. The peers
20
+ * load lazily on first render, so a build that does not generate an image never needs them.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * import { defineBuild } from "@savvy-web/bundler";
25
+ * import { ogImage } from "@savvy-web/bundler/og";
26
+ *
27
+ * export default defineBuild({
28
+ * meta: { tsdoctor: { tagline: "Every shape", openGraph: { generate: ogImage.satori() } } },
29
+ * });
30
+ * ```
31
+ *
32
+ * @public
33
+ */
34
+ declare const ogImage: {
35
+ satori(options?: SatoriOgOptions): (info: OgImageInfo) => Promise<Uint8Array>;
36
+ };
37
+ //#endregion
38
+ export { SatoriOgOptions, ogImage };
39
+ //# sourceMappingURL=og.d.ts.map
package/og.js ADDED
@@ -0,0 +1,129 @@
1
+ import { existsSync } from "node:fs";
2
+ import { readFile } from "node:fs/promises";
3
+ import { fileURLToPath } from "node:url";
4
+
5
+ //#region src/og.ts
6
+ /**
7
+ * The bundled Inter SemiBold face (SIL OFL 1.1; see `assets/LICENSE-Inter.txt`). Resolved
8
+ * relative to THIS module: the built `og.js` sits beside `assets/` at the package root, while the
9
+ * source `src/og.ts` reaches it through `public/`, so both candidates are tried.
10
+ */
11
+ const FONT_CANDIDATES = [new URL("./assets/Inter-SemiBold.ttf", import.meta.url), new URL("../public/assets/Inter-SemiBold.ttf", import.meta.url)];
12
+ function fontPath() {
13
+ for (const candidate of FONT_CANDIDATES) {
14
+ const path = fileURLToPath(candidate);
15
+ if (existsSync(path)) return path;
16
+ }
17
+ throw new Error("ogImage.satori() could not locate its bundled font assets/Inter-SemiBold.ttf");
18
+ }
19
+ async function loadRenderers() {
20
+ try {
21
+ const [{ default: satori }, { Resvg }] = await Promise.all([import("satori"), import("@resvg/resvg-js")]);
22
+ return {
23
+ satori,
24
+ Resvg
25
+ };
26
+ } catch (cause) {
27
+ throw new Error("ogImage.satori() needs the optional peers satori and @resvg/resvg-js; install both to generate Open Graph images", { cause });
28
+ }
29
+ }
30
+ function card(info, colors) {
31
+ const text = (style, children) => ({
32
+ type: "div",
33
+ props: {
34
+ style,
35
+ children
36
+ }
37
+ });
38
+ return {
39
+ type: "div",
40
+ props: {
41
+ style: {
42
+ display: "flex",
43
+ flexDirection: "column",
44
+ justifyContent: "space-between",
45
+ width: "100%",
46
+ height: "100%",
47
+ padding: 64,
48
+ background: colors.background,
49
+ color: colors.foreground,
50
+ fontFamily: "Inter"
51
+ },
52
+ children: [
53
+ text({
54
+ fontSize: 32,
55
+ color: colors.accent
56
+ }, info.project?.name ?? ""),
57
+ {
58
+ type: "div",
59
+ props: {
60
+ style: {
61
+ display: "flex",
62
+ flexDirection: "column",
63
+ gap: 16
64
+ },
65
+ children: [text({
66
+ fontSize: 72,
67
+ fontWeight: 600
68
+ }, info.name), text({
69
+ fontSize: 36,
70
+ opacity: .8
71
+ }, info.tagline ?? info.description ?? "")]
72
+ }
73
+ },
74
+ text({
75
+ fontSize: 28,
76
+ opacity: .7
77
+ }, `${info.packageName}@${info.version}`)
78
+ ]
79
+ }
80
+ };
81
+ }
82
+ /**
83
+ * Build-time Open Graph image renderers for `meta.tsdoctor.openGraph.generate`.
84
+ *
85
+ * @remarks
86
+ * `satori()` returns the default card: project name, package name and version, tagline,
87
+ * 1200×630 PNG, rendered through the optional peers `satori` and `@resvg/resvg-js`. The peers
88
+ * load lazily on first render, so a build that does not generate an image never needs them.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * import { defineBuild } from "@savvy-web/bundler";
93
+ * import { ogImage } from "@savvy-web/bundler/og";
94
+ *
95
+ * export default defineBuild({
96
+ * meta: { tsdoctor: { tagline: "Every shape", openGraph: { generate: ogImage.satori() } } },
97
+ * });
98
+ * ```
99
+ *
100
+ * @public
101
+ */
102
+ const ogImage = { satori(options = {}) {
103
+ const colors = {
104
+ accent: options.accent ?? "#38bdf8",
105
+ background: options.background ?? "#0f172a",
106
+ foreground: options.foreground ?? "#f8fafc"
107
+ };
108
+ return async (info) => {
109
+ const { satori, Resvg } = await loadRenderers();
110
+ const font = await readFile(fontPath());
111
+ const svg = await satori(card(info, colors), {
112
+ width: 1200,
113
+ height: 630,
114
+ fonts: [{
115
+ name: "Inter",
116
+ data: font,
117
+ weight: 600,
118
+ style: "normal"
119
+ }]
120
+ });
121
+ return new Uint8Array(new Resvg(svg, { fitTo: {
122
+ mode: "width",
123
+ value: 1200
124
+ } }).render().asPng());
125
+ };
126
+ } };
127
+
128
+ //#endregion
129
+ export { ogImage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@savvy-web/bundler",
3
- "version": "2.1.30",
3
+ "version": "2.2.0",
4
4
  "private": false,
5
5
  "description": "Zero-config tsdown-based bundler for Silk Suite TypeScript packages",
6
6
  "homepage": "https://github.com/savvy-web/systems/tree/main/packages/bundler",
@@ -28,22 +28,29 @@
28
28
  "./env": {
29
29
  "types": "./env.d.ts"
30
30
  },
31
+ "./og": {
32
+ "types": "./og.d.ts",
33
+ "import": "./og.js",
34
+ "default": "./og.js"
35
+ },
31
36
  "./tsconfig/ecma.json": "./tsconfig/ecma.json",
32
37
  "./package.json": "./package.json"
33
38
  },
34
39
  "dependencies": {
35
- "@savvy-web/tsdown-plugins": "2.5.11",
40
+ "@savvy-web/tsdown-plugins": "2.6.0",
36
41
  "@tsdown/exe": "^0.22.14",
37
42
  "effect": "4.0.0-rc.109",
38
43
  "rolldown": "^1.2.6",
39
44
  "tsdown": "^0.22.14"
40
45
  },
41
46
  "peerDependencies": {
47
+ "@resvg/resvg-js": "^2.6.2",
42
48
  "@types/node": "^26.4.0",
43
49
  "@types/react": "^19.2.0",
44
50
  "@types/react-dom": "^19.2.0",
45
51
  "react": "^19.2.0",
46
52
  "react-dom": "^19.2.0",
53
+ "satori": "^0.33.4",
47
54
  "typescript": "^7.0.0"
48
55
  },
49
56
  "peerDependenciesMeta": {
@@ -58,6 +65,12 @@
58
65
  },
59
66
  "react-dom": {
60
67
  "optional": true
68
+ },
69
+ "@resvg/resvg-js": {
70
+ "optional": true
71
+ },
72
+ "satori": {
73
+ "optional": true
61
74
  }
62
75
  }
63
76
  }
package/run.js CHANGED
@@ -277,6 +277,7 @@ async function runBuild(config, options) {
277
277
  meta: config.meta ?? {},
278
278
  collector,
279
279
  ci,
280
+ ...resolution !== void 0 ? { targets: resolution.targets } : {},
280
281
  ...options.generateMeta !== void 0 ? { generateMeta: options.generateMeta } : {},
281
282
  ...options.resolveNextVersions !== void 0 ? { resolveNextVersions: options.resolveNextVersions } : {}
282
283
  });