Skip to content

Commit

Permalink
internal: Enable verbatim module syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Feb 11, 2024
1 parent ba9940d commit b398aa0
Show file tree
Hide file tree
Showing 186 changed files with 309 additions and 281 deletions.
4 changes: 2 additions & 2 deletions packages/args/src/Checker.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import levenary from 'levenary';
import { interopDefault } from '@boost/internal';
import { ArgsError, ArgsErrorCode } from './ArgsError';
import { ArgsError, type ArgsErrorCode } from './ArgsError';
import { COMMAND_FORMAT } from './constants';
import { ParseError } from './ParseError';
import {
import type {
AliasMap,
LongOptionName,
OptionConfig,
Expand Down
2 changes: 1 addition & 1 deletion packages/args/src/Scope.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { castValue } from './helpers/castValue';
import { formatValue } from './helpers/formatValue';
import { LongOptionName, OptionConfig, ValueType } from './types';
import type { LongOptionName, OptionConfig, ValueType } from './types';

export class Scope {
config: OptionConfig;
Expand Down
2 changes: 1 addition & 1 deletion packages/args/src/ValidationError.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LongOptionName } from './types';
import type { LongOptionName } from './types';

export class ValidationError extends Error {
option: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/args/src/format.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ArgList, Arguments, Argv, OptionMap, ValueType } from './types';
import type { ArgList, Arguments, Argv, OptionMap, ValueType } from './types';

function mapToStringList(value: ValueType): ArgList {
if (!Array.isArray(value)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/args/src/helpers/castValue.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DEFAULT_NUMBER_VALUE } from '../constants';
import { ValueType } from '../types';
import type { ValueType } from '../types';

export function castValue(
value: unknown,
Expand Down
2 changes: 1 addition & 1 deletion packages/args/src/helpers/createScope.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Scope } from '../Scope';
import { LongOptionName, OptionConfig, OptionMap } from '../types';
import type { LongOptionName, OptionConfig, OptionMap } from '../types';

function camelCase(value: string): string {
return value.replace(/-([a-z0-9])/giu, (match, char) => String(char).toUpperCase());
Expand Down
2 changes: 1 addition & 1 deletion packages/args/src/helpers/expandShortOption.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ArgsError } from '../ArgsError';
import { AliasMap, LongOptionName, ShortOptionName } from '../types';
import type { AliasMap, LongOptionName, ShortOptionName } from '../types';

/**
* Expand a short option name to a long option name.
Expand Down
2 changes: 1 addition & 1 deletion packages/args/src/helpers/formatValue.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ArgsError } from '../ArgsError';
import { Option, ValueType } from '../types';
import type { Option, ValueType } from '../types';

export function formatValue(value: ValueType, format?: Option<ValueType>['format']): ValueType {
let nextValue = value;
Expand Down
2 changes: 1 addition & 1 deletion packages/args/src/helpers/getDefaultValue.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DEFAULT_BOOLEAN_VALUE, DEFAULT_NUMBER_VALUE, DEFAULT_STRING_VALUE } from '../constants';
import { OptionConfig, ValueType } from '../types';
import type { OptionConfig, ValueType } from '../types';

export function getDefaultValue(config: OptionConfig): ValueType {
let value = config.default as ValueType;
Expand Down
2 changes: 1 addition & 1 deletion packages/args/src/helpers/isCommand.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CommandChecker } from '../types';
import type { CommandChecker } from '../types';

/**
* Check that an argument is a command by looping through a list of available
Expand Down
2 changes: 1 addition & 1 deletion packages/args/src/helpers/mapParserOptions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
OptionConfig,
OptionMap,
ParamConfig,
Expand Down
2 changes: 1 addition & 1 deletion packages/args/src/helpers/processShortOptionGroup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-param-reassign */

import { ArgsError } from '../ArgsError';
import { AliasMap, OptionConfigMap, OptionMap, ShortOptionName } from '../types';
import type { AliasMap, OptionConfigMap, OptionMap, ShortOptionName } from '../types';
import { expandShortOption } from './expandShortOption';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/args/src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { isShortOptionGroup } from './helpers/isShortOptionGroup';
import { mapParserOptions } from './helpers/mapParserOptions';
import { processShortOptionGroup } from './helpers/processShortOptionGroup';
import { Scope } from './Scope';
import {
import type {
AliasMap,
ArgList,
Arguments,
Expand Down
9 changes: 8 additions & 1 deletion packages/args/src/parseInContext.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { ArgsError } from './ArgsError';
import { parse } from './parse';
import { ArgList, Arguments, Argv, ContextFactory, ParserOptions, PrimitiveType } from './types';
import type {
ArgList,
Arguments,
Argv,
ContextFactory,
ParserOptions,
PrimitiveType,
} from './types';

/**
* Parse a list of command line arguments (typically from `process.argv`) into an arguments
Expand Down
2 changes: 1 addition & 1 deletion packages/args/tests/__fixtures__/options.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Flag, MultipleOption, SingleOption } from '../../src';
import type { Flag, MultipleOption, SingleOption } from '../../src';

export const optConfig: SingleOption<string> = {
description: '',
Expand Down
2 changes: 1 addition & 1 deletion packages/args/tests/parse.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { Flag, parse, ParseError, ValidationError } from '../src';
import { type Flag, parse, ParseError, ValidationError } from '../src';
import {
flagConfig,
numConfig,
Expand Down
2 changes: 1 addition & 1 deletion packages/args/tests/parseInContext.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { ContextFactory, ParseError, parseInContext, ParserOptions } from '../src';
import { type ContextFactory, ParseError, parseInContext, type ParserOptions } from '../src';
import {
flagConfig,
numConfigExpanded,
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/Command.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/consistent-type-assertions */

import { execa, type Options as ExecaOptions } from 'execa';
import {
import type {
ArgList,
Arguments,
Argv,
Expand All @@ -13,8 +13,8 @@ import {
UnknownOptionMap,
} from '@boost/args';
import { isObject, Memoize } from '@boost/common';
import { Blueprint, Schemas } from '@boost/common/optimal';
import { LoggerFunction } from '@boost/log';
import type { Blueprint, Schemas } from '@boost/common/optimal';
import type { LoggerFunction } from '@boost/log';
import { CLIError } from './CLIError';
import { CommandManager } from './CommandManager';
import {
Expand All @@ -33,7 +33,7 @@ import { validateOptions } from './metadata/validateOptions';
import { validateParams } from './metadata/validateParams';
import { Program } from './Program';
import { Help } from './react';
import {
import type {
Categories,
Commandable,
CommandMetadata,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/CommandManager.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ArgList, PrimitiveType } from '@boost/args';
import type { ArgList, PrimitiveType } from '@boost/args';
import { Contract, isObject } from '@boost/common';
import { Event } from '@boost/event';
import { CLIError } from './CLIError';
import { Commandable, CommandMetadata, CommandPath } from './types';
import type { Commandable, CommandMetadata, CommandPath } from './types';

export abstract class CommandManager<Options extends object = {}> extends Contract<Options> {
/**
Expand Down
14 changes: 7 additions & 7 deletions packages/cli/src/Program.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import levenary from 'levenary';
import {
ArgList,
Arguments,
Argv,
type ArgList,
type Arguments,
type Argv,
parse,
ParseError,
parseInContext,
PrimitiveType,
type PrimitiveType,
ValidationError,
} from '@boost/args';
import { ExitError } from '@boost/common';
import { Blueprint, Schemas } from '@boost/common/optimal';
import type { Blueprint, Schemas } from '@boost/common/optimal';
import { Event } from '@boost/event';
import { env, interopDefault } from '@boost/internal';
import { createLogger, formats, LoggerFunction, StreamTransport } from '@boost/log';
import { createLogger, formats, type LoggerFunction, StreamTransport } from '@boost/log';
import { CLIError } from './CLIError';
import { Command } from './Command';
import { CommandManager } from './CommandManager';
Expand All @@ -35,7 +35,7 @@ import { getConstructor } from './metadata/getConstructor';
import { removeProcessBin } from './middleware/removeProcessBin';
import { Failure, Help, IndexHelp } from './react';
import { msg } from './translate';
import {
import type {
Categories,
Commandable,
CommandPath,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/ProgramContext.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createContext } from 'react';
import { ProgramContextType } from './types';
import type { ProgramContextType } from './types';

// @ts-expect-error Ignore default value
export const ProgramContext = createContext<ProgramContextType>();
2 changes: 1 addition & 1 deletion packages/cli/src/components/Confirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { useCallback, useEffect, useState } from 'react';
import { useFocus } from 'ink';
import { msg } from '../translate';
import { Prompt, PromptProps } from './internal/Prompt';
import { Prompt, type PromptProps } from './internal/Prompt';
import { Selected } from './internal/Selected';
import { Style } from './Style';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/components/Failure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { CLIError } from '../CLIError';
import { DELIMITER, SPACING_COL, SPACING_ROW } from '../constants';
import { applyStyle } from '../helpers/applyStyle';
import { msg } from '../translate';
import { StyleType } from '../types';
import type { StyleType } from '../types';
import { Header } from './Header';
import { Style } from './Style';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Box } from 'ink';
import { SPACING_ROW } from '../constants';
import { StyleType } from '../types';
import type { StyleType } from '../types';
import { Style } from './Style';

export interface HeaderProps {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/components/Help.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Box, Text } from 'ink';
import { OptionConfigMap, ParamConfigList } from '@boost/args';
import type { OptionConfigMap, ParamConfigList } from '@boost/args';
import { SPACING_COL } from '../constants';
import { formatDescription } from '../helpers';
import { Categories, CommandConfig, CommandConfigMap } from '../types';
import type { Categories, CommandConfig, CommandConfigMap } from '../types';
import { Header } from './Header';
import { HelpCommands } from './internal/HelpCommands';
import { HelpOptions } from './internal/HelpOptions';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/components/HiddenInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Input, InputProps } from './Input';
import { Input, type InputProps } from './Input';

export type HiddenInputProps = Omit<InputProps, 'hideCursor' | 'mask'>;

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/components/IndexHelp.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ReactNode } from 'react';
import { Box, Text } from 'ink';
import { SPACING_ROW } from '../constants';
import { ProgramOptions } from '../types';
import type { ProgramOptions } from '../types';
import { Style } from './Style';

export interface IndexHelpProps extends ProgramOptions {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/components/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCallback, useState } from 'react';
import { useFocus } from 'ink';
import { Cursor } from './internal/Cursor';
import { Prompt, PromptProps } from './internal/Prompt';
import { Prompt, type PromptProps } from './internal/Prompt';
import { Style } from './Style';

export interface InputProps extends PromptProps<string> {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/components/MultiSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { OptionRow } from './internal/OptionRow';
import { Prompt } from './internal/Prompt';
import { ScrollableList } from './internal/ScrollableList';
import { Selected } from './internal/Selected';
import { normalizeOptions, SelectOption, SelectProps } from './Select';
import { normalizeOptions, type SelectOption, type SelectProps } from './Select';

export interface MultiSelectProps<T> extends SelectProps<T[], T> {
/** List of option values selected by default. */
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/components/PasswordInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Input, InputProps } from './Input';
import { Input, type InputProps } from './Input';

export type PasswordInputProps = Omit<InputProps, 'mask'>;

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/components/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { figures } from '@boost/terminal';
import { useListNavigation } from '../hooks';
import { DividerRow } from './internal/DividerRow';
import { OptionRow } from './internal/OptionRow';
import { Prompt, PromptProps } from './internal/Prompt';
import { ScrollableList, ScrollableListProps } from './internal/ScrollableList';
import { Prompt, type PromptProps } from './internal/Prompt';
import { ScrollableList, type ScrollableListProps } from './internal/ScrollableList';
import { Selected } from './internal/Selected';

export type SelectOptionLike<T> =
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/components/Style.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ReactNode } from 'react';
import { Text, TextProps } from 'ink';
import { Text, type TextProps } from 'ink';
import { loadTheme } from '../helpers/loadTheme';
import { StyleType, Writeable } from '../types';
import type { StyleType, Writeable } from '../types';

export interface StyleProps extends Pick<TextProps, 'bold' | 'italic' | 'underline' | 'wrap'> {
children: NonNullable<ReactNode>;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/components/internal/HelpCommands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { stripAnsi } from '@boost/terminal';
import { SPACING_COL, SPACING_COL_WIDE, SPACING_ROW } from '../../constants';
import { formatCommandCall, formatDescription, groupByCategory } from '../../helpers';
import { msg } from '../../translate';
import { Categories, CommandConfigMap } from '../../types';
import type { Categories, CommandConfigMap } from '../../types';
import { Header } from '../Header';
import { Style } from '../Style';

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/components/internal/HelpOptions.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { useMemo, useRef } from 'react';
import { Box, Text } from 'ink';
import { OptionConfig, OptionConfigMap } from '@boost/args';
import type { OptionConfig, OptionConfigMap } from '@boost/args';
import { stripAnsi } from '@boost/terminal';
import { SPACING_COL, SPACING_COL_WIDE, SPACING_ROW } from '../../constants';
import { formatDescription, formatType, groupByCategory } from '../../helpers';
import { msg } from '../../translate';
import { Categories } from '../../types';
import type { Categories } from '../../types';
import { Header } from '../Header';
import { Style } from '../Style';

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/components/internal/HelpParams.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useMemo } from 'react';
import { Box, Text } from 'ink';
import { ParamConfig, ParamConfigList } from '@boost/args';
import type { ParamConfig, ParamConfigList } from '@boost/args';
import { SPACING_COL, SPACING_COL_WIDE } from '../../constants';
import { formatDescription, formatType, getLongestWidth } from '../../helpers';
import { msg } from '../../translate';
import { CommandConfig } from '../../types';
import type { CommandConfig } from '../../types';
import { Header } from '../Header';

function gatherParamTags(config: ParamConfig): string[] {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/components/internal/Prompt.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type ReactNode, useCallback, useState } from 'react';
import { Box, Key, useFocusManager, useInput } from 'ink';
import { Box, type Key, useFocusManager, useInput } from 'ink';
import { figures } from '@boost/terminal';
import { useIsMounted } from '../../hooks/useIsMounted';
import { Style } from '../Style';
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/components/internal/Wrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Component, type ReactNode } from 'react';
import { Box } from 'ink';
import { ProgramContext } from '../../ProgramContext';
import { ProgramContextType } from '../../types';
import type { ProgramContextType } from '../../types';
import { Failure } from '../Failure';
import { LogWriter, LogWriterProps } from './LogWriter';
import { LogWriter, type LogWriterProps } from './LogWriter';

export interface WrapperProps extends LogWriterProps, ProgramContextType {
children: ReactNode;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ExitCode } from './types';
import type { ExitCode } from './types';

// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
export const VERSION_FORMAT =
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/decorators/Config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CommandStaticConfig, PartialConfig } from '../types';
import type { CommandStaticConfig, PartialConfig } from '../types';

/**
* A class decorator for defining the following metadata on a `Command`.
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/decorators/Flag.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Flag as FlagConfig } from '@boost/args';
import type { Flag as FlagConfig } from '@boost/args';
import { createOptionDecorator } from '../metadata/createOptionDecorator';
import { PartialConfig } from '../types';
import type { PartialConfig } from '../types';

/**
* A property decorator for declaring a command line flag (boolean value).
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/decorators/Number.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SingleOption } from '@boost/args';
import type { SingleOption } from '@boost/args';
import { createOptionDecorator } from '../metadata/createOptionDecorator';
import { PartialConfig } from '../types';
import type { PartialConfig } from '../types';

/**
* A property decorator for declaring a command line option with a numeric value.
Expand Down
Loading

0 comments on commit b398aa0

Please sign in to comment.