Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 19 additions & 0 deletions .chronus/changes/internal-type-imports-2026-7-21.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
changeKind: internal
packages:
- "@alloy-js/babel-plugin"
- "@alloy-js/cli"
- "@alloy-js/core"
- "@alloy-js/csharp"
- "@alloy-js/go"
- "@alloy-js/java"
- "@alloy-js/json"
- "@alloy-js/markdown"
- "@alloy-js/msbuild"
- "@alloy-js/python"
- "@alloy-js/rollup-plugin"
- "@alloy-js/typescript"
- "@alloy-js/typespec"
---

Adopt explicit `import type` / `export type` across the codebase (enforced via TypeScript's `verbatimModuleSyntax`) and re-enable Babel 8's default `onlyRemoveTypeImports: true` by dropping the stopgap override in the CLI and rollup-plugin builds.
2 changes: 1 addition & 1 deletion packages/babel-plugin-alloy/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NodePath } from "@babel/core";
import type { NodePath } from "@babel/core";
import SyntaxJSX from "@babel/plugin-syntax-jsx";
import * as t from "@babel/types";

Expand Down
2 changes: 1 addition & 1 deletion packages/babel-plugin-alloy/src/transform.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NodePath } from "@babel/core";
import type { NodePath } from "@babel/core";
import * as t from "@babel/types";
interface Options {
alloyModuleName: string | undefined;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/babel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function buildFile(filename: string, options: BuildOptions) {
return babel.transformFileAsync(filename, {
sourceMaps: options.sourceMaps,
presets: [
[typescriptPreset, { onlyRemoveTypeImports: false }],
typescriptPreset,
[alloyPreset, { addSourceInfo: options.addSourceInfo }],
],
});
Expand Down
16 changes: 5 additions & 11 deletions packages/core/src/binder.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
import { computed, Ref, ShallowRef, shallowRef } from "@vue/reactivity";
import type { Ref, ShallowRef } from "@vue/reactivity";
import { computed, shallowRef } from "@vue/reactivity";

import { useBinder } from "./context/binder.js";
import { useMemberContext } from "./context/member-scope.js";
import { useScope } from "./context/scope.js";
import { debug, TracePhase } from "./debug/index.js";
import { emitDiagnostic, type DiagnosticHandle } from "./diagnostics.js";
import { effect, onCleanup } from "./reactivity.js";
import {
inspectRefkey,
isMemberRefkey,
MemberRefkey,
refkey,
Refkey,
Refkeyable,
toRefkey,
} from "./refkey.js";
import { OutputScope } from "./symbols/output-scope.js";
import type { MemberRefkey, Refkey, Refkeyable } from "./refkey.js";
import { inspectRefkey, isMemberRefkey, refkey, toRefkey } from "./refkey.js";
import type { OutputScope } from "./symbols/output-scope.js";
import { type OutputSymbol } from "./symbols/output-symbol.js";
import { formatRefkeys, formatSymbolName } from "./tracer.js";
export type Metadata = object;
Expand Down
8 changes: 3 additions & 5 deletions packages/core/src/components/AccessExpression.test.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { describe, expect, it } from "vitest";

import {
BasePartProps,
createAccessExpression,
} from "../components/AccessExpression.jsx";
import type { BasePartProps } from "../components/AccessExpression.jsx";
import { createAccessExpression } from "../components/AccessExpression.jsx";
import { code } from "../index.js";
import { Children } from "../runtime/component.js";
import type { Children } from "../runtime/component.js";

interface TestPartProps extends BasePartProps {
name?: string;
Expand Down
10 changes: 6 additions & 4 deletions packages/core/src/components/AccessExpression.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import {
import type {
Children,
childrenArray,
ComponentCreator,
ComponentDefinition,
computed,
isComponentCreator,
OutputSymbol,
Refkeyable,
} from "../index.js";
import {
childrenArray,
computed,
isComponentCreator,
symbolForRefkey,
takeSymbols,
} from "../index.js";
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/components/AppendFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { useContext } from "../context.js";
import { SourceDirectoryContext } from "../context/source-directory.js";
import { emitDiagnostic } from "../diagnostics.js";
import { createFileResource } from "../resource.js";
import { Children, isComponentCreator } from "../runtime/component.js";
import type { Children } from "../runtime/component.js";
import { isComponentCreator } from "../runtime/component.js";
import { childrenArray } from "../utils.jsx";
import { SourceFile } from "./SourceFile.jsx";

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/CopyFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { join } from "pathe";

import { useContext } from "../context.js";
import { SourceDirectoryContext } from "../context/source-directory.js";
import { CopyFileContext } from "../context/source-file.js";
import type { CopyFileContext } from "../context/source-file.js";
import { getContext } from "../reactivity.js";

export interface CopyFileProps {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/components/Declaration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { BinderContext } from "../context/binder.js";
import { DeclarationContext } from "../context/declaration.js";
import { useScope } from "../context/scope.js";
import { onCleanup } from "../reactivity.js";
import { Namekey, Refkey } from "../refkey.js";
import type { Namekey, Refkey } from "../refkey.js";
import type { Children } from "../runtime/component.js";
import { BasicScope } from "../symbols/basic-scope.js";
import { BasicSymbol } from "../symbols/basic-symbol.js";
import { OutputSymbol } from "../symbols/output-symbol.js";
import type { OutputSymbol } from "../symbols/output-symbol.js";

/**
* Create a declaration by providing an already created symbol. The symbol is
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/components/For.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { isRef, Ref } from "@vue/reactivity";
import type { Ref } from "@vue/reactivity";
import { isRef } from "@vue/reactivity";

import { memo } from "../reactivity.js";
import type { Children } from "../runtime/component.js";
import { baseListPropsToMapJoinArgs, mapJoin } from "../utils.js";
import { BaseListProps } from "./List.jsx";
import type { BaseListProps } from "./List.jsx";

export type ForCallbackArgs<T> = number extends keyof T
? [value: T[number]]
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/MemberDeclaration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useMemberContext } from "../context/member-scope.js";
import type { Namekey, Refkey } from "../refkey.js";
import type { Children } from "../runtime/component.js";
import { BasicSymbol } from "../symbols/basic-symbol.js";
import { OutputSymbol } from "../symbols/output-symbol.js";
import type { OutputSymbol } from "../symbols/output-symbol.js";

/**
* Create a member declaration by providing a symbol name and optional symbol
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/MemberScope.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { MemberContext } from "../context/member-scope.js";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { ScopeContext } from "../context/scope.js";
import type { Children } from "../runtime/component.js";
import { OutputScope } from "../symbols/output-scope.js";
import type { OutputScope } from "../symbols/output-scope.js";
import type { OutputSymbol } from "../symbols/output-symbol.js";
import { Scope } from "./Scope.jsx";

Expand Down
12 changes: 4 additions & 8 deletions packages/core/src/components/Output.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import {
createOutputBinder,
getSymbolCreator,
NameConflictResolver,
SymbolCreator,
} from "../binder.js";
import type { NameConflictResolver, SymbolCreator } from "../binder.js";
import { createOutputBinder, getSymbolCreator } from "../binder.js";
import { BinderContext } from "../context/binder.js";
import { FormatOptions } from "../context/format-options.js";
import { NamePolicyContext } from "../context/name-policy.js";
import { NamePolicy } from "../name-policy.js";
import { PrintTreeOptions } from "../output-types.js";
import type { NamePolicy } from "../name-policy.js";
import type { PrintTreeOptions } from "../output-types.js";
import type { Children } from "../runtime/component.js";
import { SourceDirectory } from "./SourceDirectory.js";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/components/Scope.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { ScopeContext, useScope } from "../context/scope.js";
import { debug } from "../debug/index.js";
import type { Children } from "../runtime/component.js";
import { BasicScope } from "../symbols/basic-scope.js";
import { OutputScope } from "../symbols/output-scope.js";
import { OutputSymbol } from "../symbols/output-symbol.js";
import type { OutputScope } from "../symbols/output-scope.js";
import type { OutputSymbol } from "../symbols/output-symbol.js";

/**
* Declare a scope by providing an already created scope. The scope is merely
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/components/SourceFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { useContext } from "../context.js";
import { useFormatOptions } from "../context/format-options.js";
import { SourceDirectoryContext } from "../context/source-directory.js";
import { SourceFileContext } from "../context/source-file.js";
import { PrintTreeOptions } from "../output-types.js";
import type { PrintTreeOptions } from "../output-types.js";
import { getContext } from "../reactivity.js";
import { Refkey } from "../refkey.js";
import type { Refkey } from "../refkey.js";
import type { Children, ComponentDefinition } from "../runtime/component.js";
import { Show } from "./Show.jsx";

Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/components/TemplateFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { computed } from "@vue/reactivity";

import { emitDiagnostic } from "../diagnostics.js";
import { createFileResource } from "../resource.js";
import { Children, isComponentCreator } from "../runtime/component.js";
import type { Children } from "../runtime/component.js";
import { isComponentCreator } from "../runtime/component.js";
import { childrenArray } from "../utils.jsx";
import { SourceFile } from "./SourceFile.jsx";

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/UpdateFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { join } from "pathe";
import { useContext } from "../context.js";
import { SourceDirectoryContext } from "../context/source-directory.js";
import { createFileResource } from "../resource.js";
import { Children } from "../runtime/component.js";
import type { Children } from "../runtime/component.js";
import { SourceFile } from "./SourceFile.jsx";
/**
* Props for the UpdateFile component.
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/content-slot.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { computed, Ref, shallowRef } from "@vue/reactivity";
import type { Ref } from "@vue/reactivity";
import { computed, shallowRef } from "@vue/reactivity";

import { Show } from "./components/Show.jsx";
import { ensureIsEmpty, getContext } from "./reactivity.js";
import { Children, Component } from "./runtime/component.js";
import type { Children, Component } from "./runtime/component.js";

export interface ContentSlot {
(props: { children: Children }): Children;
Expand Down
7 changes: 2 additions & 5 deletions packages/core/src/context/assignment.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {
ComponentContext,
createNamedContext,
useContext,
} from "../context.js";
import type { ComponentContext } from "../context.js";
import { createNamedContext, useContext } from "../context.js";
import type { OutputSymbol } from "../symbols/output-symbol.js";

export interface AssignmentContext {
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/context/declaration.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ComponentContext, createNamedContext } from "../context.js";
import type { ComponentContext } from "../context.js";
import { createNamedContext } from "../context.js";
import type { OutputSymbol } from "../symbols/output-symbol.js";

export const DeclarationContext: ComponentContext<OutputSymbol> =
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/context/format-options.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createNamedContext, useContext } from "../context.js";
import { PrintTreeOptions } from "../output-types.js";
import type { PrintTreeOptions } from "../output-types.js";

export interface CommonFormatOptions extends PrintTreeOptions {}

Expand Down
7 changes: 2 additions & 5 deletions packages/core/src/context/member-declaration.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {
ComponentContext,
createNamedContext,
useContext,
} from "../context.js";
import type { ComponentContext } from "../context.js";
import { createNamedContext, useContext } from "../context.js";
import type { OutputSymbol } from "../symbols/output-symbol.js";

/**
Expand Down
9 changes: 3 additions & 6 deletions packages/core/src/context/member-scope.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import {
ComponentContext,
createNamedContext,
useContext,
} from "../context.js";
import { OutputSymbol } from "../symbols/output-symbol.js";
import type { ComponentContext } from "../context.js";
import { createNamedContext, useContext } from "../context.js";
import type { OutputSymbol } from "../symbols/output-symbol.js";

/**
* The member context provides the symbol upon which new member symbols
Expand Down
7 changes: 2 additions & 5 deletions packages/core/src/context/name-policy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {
ComponentContext,
createNamedContext,
useContext,
} from "../context.js";
import type { ComponentContext } from "../context.js";
import { createNamedContext, useContext } from "../context.js";
import type { NamePolicy } from "../name-policy.js";

export const NamePolicyContext: ComponentContext<NamePolicy<string>> =
Expand Down
7 changes: 2 additions & 5 deletions packages/core/src/context/scope.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {
ComponentContext,
createNamedContext,
useContext,
} from "../context.js";
import type { ComponentContext } from "../context.js";
import { createNamedContext, useContext } from "../context.js";
import type { OutputScope } from "../symbols/output-scope.js";

export const ScopeContext: ComponentContext<OutputScope> =
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/context/source-directory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ComponentContext, createNamedContext } from "../context.js";
import type { ComponentContext } from "../context.js";
import { createNamedContext } from "../context.js";
import type { CopyFileContext, SourceFileContext } from "./source-file.js";

export interface SourceDirectoryContext {
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/context/source-file.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ComponentContext, createNamedContext } from "../context.js";
import type { ComponentContext } from "../context.js";
import { createNamedContext } from "../context.js";
import type { Refkey } from "../refkey.js";
import { ComponentDefinition } from "../runtime/component.js";
import type { ComponentDefinition } from "../runtime/component.js";

export interface CopyFileContext {
path: string;
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/debug/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,14 @@ import {
} from "../devtools/devtools-server.js";
import { getContext, untrack } from "../reactivity.js";
import { getContextForNode } from "../render/node-context.js";
import type { ElementNode, TextNode } from "../render/node.js";
import {
AlloyNode,
CommentNode,
ELEMENT_NODE,
ElementNode,
FRAGMENT_NODE,
setMutationListener,
TEXT_NODE,
TextNode,
} from "../render/node.js";
import { flushJobsAsync } from "../scheduler.js";
import type { ComponentCreator } from "./../runtime/component.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/host/alloy-host.browser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AlloyFileInterface, AlloyHostInterface } from "./interface.js";
import type { AlloyFileInterface, AlloyHostInterface } from "./interface.js";

export const AlloyHost: AlloyHostInterface = {
read(source: string): AlloyFileInterface {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/host/alloy-host.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createReadStream, createWriteStream } from "fs";
import { access, mkdir, readFile, writeFile } from "fs/promises";

import { AlloyFileInterface, AlloyHostInterface } from "./interface.js";
import type { AlloyFileInterface, AlloyHostInterface } from "./interface.js";

export const AlloyHost: AlloyHostInterface = {
read(source: string): AlloyFileInterface {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export * from "./context/index.js";
export * from "./diagnostics.js";
export * from "./library-symbol-reference.js";
export * from "./name-policy.js";
export * from "./output-types.js";
export type * from "./output-types.js";
export * from "./props-combinators.js";
export * from "./reactive-union-set.js";
export {
Expand Down Expand Up @@ -91,7 +91,7 @@ export {
} from "./render/node.js";
export * from "./resource.js";
export * from "./runtime/component.js";
export * from "./runtime/intrinsic.js";
export type * from "./runtime/intrinsic.js";
export * from "./stc.js";
export * from "./sti.js";
export * from "./symbols/index.js";
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/library-symbol-reference.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RefkeyableObject } from "./refkey.js";
import { OutputSymbol } from "./symbols/output-symbol.js";
import type { RefkeyableObject } from "./refkey.js";
import type { OutputSymbol } from "./symbols/output-symbol.js";

/**
* Well-known symbol for the lazy-symbol-creation protocol used by external
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/pretty-string/pretty-string.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect, it } from "vitest";

import { pret, PrettyString } from "./pretty-string.js";
import type { PrettyString } from "./pretty-string.js";
import { pret } from "./pretty-string.js";

function expectRender(
pretty: PrettyString,
Expand Down
Loading
Loading