Repository: alloy-framework/alloy
Pull request #78 (2025-04-04 22:00:54)

Move prose to core

github-actions[bot]: <!--chronus-github-change-commenter-->
All changed packages have been documented.
 - :white_check_mark: `@alloy-js/core`
 - :white_check_mark: `@alloy-js/typescript`

<details>
<summary>Show changes</summary>

### `@alloy-js/typescript` - _internal_ [✏️](https://github.com/bterlson/alloy/edit/move-prose-to-core/.chronus/changes/move-prose-to-core-2025-3-4-15-0-17.md?pr=/alloy-framework/alloy/pull/78)
> 
### `@alloy-js/core` - _feature_ [✏️](https://github.com/bterlson/alloy/edit/move-prose-to-core/.chronus/changes/move-prose-to-core-2025-3-4-15-0-9.md?pr=/alloy-framework/alloy/pull/78)
> Add `Prose` component for wrapping string paragraphs at the line width.
</details>

pkg-pr-new[bot]: 
[Open in StackBlitz](https://pkg.pr.new/template/e975cd01-4f6c-43db-8611-ea0f8c8df05a)


<details><summary><b>@alloy-js/babel-plugin</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/babel-plugin@78
```

</p></details>
      
    

<details><summary><b>@alloy-js/babel-plugin-jsx-dom-expressions</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/babel-plugin-jsx-dom-expressions@78
```

</p></details>
      
    

<details><summary><b>@alloy-js/babel-preset</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/babel-preset@78
```

</p></details>
      
    

<details><summary><b>@alloy-js/core</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/core@78
```

</p></details>
      
    

<details><summary><b>@alloy-js/create</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/create@78
```

</p></details>
      
    

<details><summary><b>@alloy-js/csharp</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/csharp@78
```

</p></details>
      
    

<details><summary><b>@alloy-js/java</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/java@78
```

</p></details>
      
    

<details><summary><b>@alloy-js/json</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/json@78
```

</p></details>
      
    

<details><summary><b>@alloy-js/prettier-plugin-alloy</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/prettier-plugin-alloy@78
```

</p></details>
      
    

<details><summary><b>@alloy-js/rollup-plugin</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/rollup-plugin@78
```

</p></details>
      
    

<details><summary><b>@alloy-js/typescript</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/typescript@78
```

</p></details>
      
    

_commit: <a href="https://github.com/alloy-framework/alloy/runs/40016257440"><code>02d146c</code></a>_


Patch:
diff --git a/.chronus/changes/move-prose-to-core-2025-3-4-15-0-17.md b/.chronus/changes/move-prose-to-core-2025-3-4-15-0-17.md
new file mode 100644
index 0000000..c17deac
--- /dev/null
+++ b/.chronus/changes/move-prose-to-core-2025-3-4-15-0-17.md
@@ -0,0 +1,6 @@
+---
+changeKind: internal
+packages:
+  - "@alloy-js/typescript"
+---
+
diff --git a/.chronus/changes/move-prose-to-core-2025-3-4-15-0-9.md b/.chronus/changes/move-prose-to-core-2025-3-4-15-0-9.md
new file mode 100644
index 0000000..5f2f287
--- /dev/null
+++ b/.chronus/changes/move-prose-to-core-2025-3-4-15-0-9.md
@@ -0,0 +1,7 @@
+---
+changeKind: feature
+packages:
+  - "@alloy-js/core"
+---
+
+Add `Prose` component for wrapping string paragraphs at the line width.
\ No newline at end of file
diff --git a/packages/typescript/src/components/Prose.tsx b/packages/core/src/components/Prose.tsx
similarity index 100%
rename from packages/typescript/src/components/Prose.tsx
rename to packages/core/src/components/Prose.tsx
diff --git a/packages/core/src/components/index.tsx b/packages/core/src/components/index.tsx
index 37fcbf7..fda66b2 100644
--- a/packages/core/src/components/index.tsx
+++ b/packages/core/src/components/index.tsx
@@ -8,6 +8,7 @@ export * from "./MemberName.jsx";
 export * from "./MemberScope.jsx";
 export * from "./Name.jsx";
 export * from "./Output.js";
+export * from "./Prose.jsx";
 export * from "./Scope.js";
 export * from "./Show.jsx";
 export * from "./SourceDirectory.js";
diff --git a/packages/core/src/components/stc/index.ts b/packages/core/src/components/stc/index.ts
index c082b50..c145375 100644
--- a/packages/core/src/components/stc/index.ts
+++ b/packages/core/src/components/stc/index.ts
@@ -11,6 +11,7 @@ export const MemberName = stc(base.MemberName);
 export const MemberScope = stc(base.MemberScope);
 export const Name = stc(base.Name);
 export const Output = stc(base.Output);
+export const Prose = stc(base.Prose);
 export const Scope = stc(base.Scope);
 export const Show = stc(base.Show);
 export const StatementList = stc(base.StatementList);
diff --git a/packages/typescript/src/components/ClassDeclaration.tsx b/packages/typescript/src/components/ClassDeclaration.tsx
index b4fbc06..0373ca5 100644
--- a/packages/typescript/src/components/ClassDeclaration.tsx
+++ b/packages/typescript/src/components/ClassDeclaration.tsx
@@ -4,12 +4,14 @@ import {
   MemberDeclaration,
   Name,
   OutputSymbolFlags,
+  Prose,
   Refkey,
   Scope,
   Show,
   splitProps,
   useMemberScope,
 } from "@alloy-js/core";
+
 import { usePrivateScope } from "../context/private-scope.js";
 import { useTSNamePolicy } from "../name-policy.js";
 import { TSOutputScope } from "../symbols/scopes.js";
@@ -20,7 +22,6 @@ import { BaseDeclarationProps, Declaration } from "./Declaration.jsx";
 import { JSDoc } from "./JSDoc.jsx";
 import { JSDocParams } from "./JSDocParam.jsx";
 import { PropertyName } from "./PropertyName.jsx";
-import { Prose } from "./Prose.jsx";
 
 export interface ClassDeclarationProps extends BaseDeclarationProps {
   extends?: Children;
diff --git a/packages/typescript/src/components/FunctionDeclaration.tsx b/packages/typescript/src/components/FunctionDeclaration.tsx
index 7130d6f..8d75821 100644
--- a/packages/typescript/src/components/FunctionDeclaration.tsx
+++ b/packages/typescript/src/components/FunctionDeclaration.tsx
@@ -7,6 +7,7 @@ import {
   For,
   Indent,
   Name,
+  Prose,
   Scope,
   Show,
   taggedComponent,
@@ -27,7 +28,6 @@ import { CallSignature, CallSignatureProps } from "./CallSignature.jsx";
 import { BaseDeclarationProps, Declaration } from "./Declaration.js";
 import { JSDoc } from "./JSDoc.jsx";
 import { JSDocParams } from "./JSDocParam.jsx";
-import { Prose } from "./Prose.jsx";
 
 export interface FunctionDeclarationProps
   extends BaseDeclarationProps,
diff --git a/packages/typescript/src/components/JSDocParam.tsx b/packages/typescript/src/components/JSDocParam.tsx
index 98fb017..ff5cc7a 100644
--- a/packages/typescript/src/components/JSDocParam.tsx
+++ b/packages/typescript/src/components/JSDocParam.tsx
@@ -1,7 +1,6 @@
-import { For, Show } from "@alloy-js/core";
+import { For, Prose, Show } from "@alloy-js/core";
 import { Children } from "@alloy-js/core/jsx-runtime";
 import { ParameterDescriptor } from "../parameter-descriptor.js";
-import { Prose } from "./Prose.jsx";
 
 export interface JSDocParamsProps {
   parameters: ParameterDescriptor[] | string[];
diff --git a/packages/typescript/src/components/SingleLineCommentBlock.tsx b/packages/typescript/src/components/SingleLineCommentBlock.tsx
index 038ab69..236987c 100644
--- a/packages/typescript/src/components/SingleLineCommentBlock.tsx
+++ b/packages/typescript/src/components/SingleLineCommentBlock.tsx
@@ -1,5 +1,5 @@
+import { Prose } from "@alloy-js/core";
 import { Children } from "@alloy-js/core/jsx-runtime";
-import { Prose } from "./Prose.jsx";
 
 export interface SingleLineCommentBlockProps {
   children: Children;
diff --git a/packages/typescript/src/components/index.ts b/packages/typescript/src/components/index.ts
index c213981..ec6fbc6 100644
--- a/packages/typescript/src/components/index.ts
+++ b/packages/typescript/src/components/index.ts
@@ -20,7 +20,6 @@ export * from "./MemberChainExpression.jsx";
 export * from "./ObjectExpression.js";
 export * from "./PackageDirectory.js";
 export * from "./PackageJson.js";
-export * from "./Prose.jsx";
 export * from "./Reference.js";
 export * from "./SourceFile.js";
 export * from "./SwitchStatement.jsx";
diff --git a/packages/typescript/src/components/stc/index.ts b/packages/typescript/src/components/stc/index.ts
index 928f889..efb6a45 100644
--- a/packages/typescript/src/components/stc/index.ts
+++ b/packages/typescript/src/components/stc/index.ts
@@ -28,7 +28,6 @@ export const ObjectExpression = stc(base.ObjectExpression);
 export const ObjectProperty = stc(base.ObjectProperty);
 export const PackageDirectory = stc(base.PackageDirectory);
 export const PackageJsonFile = stc(base.PackageJsonFile);
-export const Prose = stc(base.Prose);
 export const Reference = stc(base.Reference);
 export const SourceFile = stc(base.SourceFile);
 export const SwitchStatement = stc(base.SwitchStatement);
diff --git a/packages/typescript/tsconfig.json b/packages/typescript/tsconfig.json
index a2b8f17..131612d 100644
--- a/packages/typescript/tsconfig.json
+++ b/packages/typescript/tsconfig.json
@@ -6,13 +6,6 @@
     "outDir": "dist"
   },
   "references": [{ "path": "../core" }],
-  "include": [
-    "src/**/*.ts",
-    "src/**/*.tsx",
-    "test/**/*.ts",
-    "test/**/*.tsx",
-    "../core/src/components/Block.tsx",
-    "../core/src/components/StatementList.tsx"
-  ],
+  "include": ["src/**/*.ts", "src/**/*.tsx", "test/**/*.ts", "test/**/*.tsx"],
   "exclude": ["node_modules", "dist"]
 }


Test patch:
diff --git a/packages/core/test/components/prose.test.tsx b/packages/core/test/components/prose.test.tsx
new file mode 100644
index 0000000..b3844ed
--- /dev/null
+++ b/packages/core/test/components/prose.test.tsx
@@ -0,0 +1,36 @@
+import { describe, expect, it } from "vitest";
+import { Prose } from "../../src/components/Prose.jsx";
+import "../../testing/extend-expect.js";
+import { d } from "../../testing/render.js";
+
+describe("Prose", () => {
+  it("formats properly", () => {
+    const template = (
+      <>
+        <Prose>
+          This is a long paragraph that should end up being broken into multiple
+          lines.
+        </Prose>
+        <hbr />
+        <hbr />
+        <Prose>
+          This is another paragraph. There should be a couple breaks in front of
+          it.
+        </Prose>
+      </>
+    );
+
+    expect(template).toRenderTo(
+      d`
+        This is a long paragraph that
+        should end up being broken
+        into multiple lines.
+
+        This is another paragraph.
+        There should be a couple
+        breaks in front of it. 
+      `,
+      { printWidth: 30 },
+    );
+  });
+});
diff --git a/packages/typescript/test/jsdoc.test.tsx b/packages/typescript/test/jsdoc.test.tsx
index a15c3b3..75df854 100644
--- a/packages/typescript/test/jsdoc.test.tsx
+++ b/packages/typescript/test/jsdoc.test.tsx
@@ -1,10 +1,10 @@
+import { Prose } from "@alloy-js/core";
 import "@alloy-js/core/testing";
 import { d } from "@alloy-js/core/testing";
 import { describe, expect, it } from "vitest";
 import { JSDoc } from "../src/components/JSDoc.jsx";
 import { JSDocComment } from "../src/components/JSDocComment.jsx";
 import { JSDocExample } from "../src/components/JSDocExample.jsx";
-import { Prose } from "../src/components/Prose.jsx";
 import { FunctionCallExpression } from "../src/index.js";
 
 describe("JSDoc", () => {