-
-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
emitted dts is bundled source #509
Comments
can't reproduce it 🤔 |
I cannot reproduce it in another folder (even when I clone the same repo), so I'm not sure what the issue is. |
Not able to reproduce so I'll close this. |
Ah ok, I figured this out. It happens when |
should be fixed in v5.11.9 |
I got something different.
tsc's dts is not the same as what tsup is emitting (noEmit: Sourcepackages/electron-esbuild/src/config/config.ts (may not be up to date with my local version) /*
* Copyright (c) 2021 Kiyozz.
*
* All rights reserved.
*/
import { BuildOptions } from 'esbuild'
import { InlineConfig } from 'vite'
import { Configuration } from 'webpack'
import { Builder } from '../builder'
import { EsbuildBuilder } from '../builder/esbuild.builder'
import { ViteBuilder } from '../builder/vite.builder'
import { WebpackBuilder } from '../builder/webpack.builder'
import { unsupportedType } from '../console'
import { Configurator } from './configurators/base.configurator'
import { EsbuildConfigurator } from './configurators/esbuild.configurator'
import { ViteConfigurator } from './configurators/vite.configurator'
import { WebpackConfigurator } from './configurators/webpack.configurator'
import { Target, TypeConfig } from './enums'
import { PossibleConfiguration } from './types'
import { YamlItem } from './yaml'
export class EnvConfig {
readonly type: TypeConfig
readonly path: string
readonly src: string
readonly output: string
readonly html?: string
constructor({
type,
path,
src,
output,
html,
}: {
type: TypeConfig
path: string
src: string
output: string
html?: string
}) {
this.type = type
this.path = path
this.src = src
this.output = output
this.html = html
}
static fromYaml(yaml: YamlItem): EnvConfig {
return new this({
type: yaml.type,
path: yaml.path,
src: yaml.src,
output: yaml.output,
html: yaml.html,
})
}
toConfigurator(): Configurator<TypeConfig> {
switch (this.type) {
case TypeConfig.esbuild:
return new EsbuildConfigurator(this)
case TypeConfig.webpack:
return new WebpackConfigurator(this)
case TypeConfig.vite:
return new ViteConfigurator(this)
default:
unsupportedType(this.type)
}
}
}
export class Item<
T extends PossibleConfiguration | null = PossibleConfiguration,
F extends EnvConfig | null = EnvConfig | null,
> {
readonly config: T
readonly fileConfig: F
readonly target: Target
readonly isVite: boolean
readonly isWebpack: boolean
readonly isEsbuild: boolean
readonly isMain: boolean
readonly isRenderer: boolean
constructor({
config,
fileConfig,
target,
}: {
config: T
fileConfig: F
target: Target
}) {
this.config = config
this.fileConfig = fileConfig
this.target = target
this.isVite = this.fileConfig?.type === TypeConfig.vite
this.isWebpack = this.fileConfig?.type === TypeConfig.webpack
this.isEsbuild = this.fileConfig?.type === TypeConfig.esbuild
this.isMain = this.target === Target.main
this.isRenderer = this.target === Target.renderer
}
toBuilder(): Builder | null {
if (this.isEsbuild) {
return new EsbuildBuilder(this as Item<BuildOptions>)
} else if (this.isWebpack) {
return new WebpackBuilder(this as Item<Configuration>)
} else if (this.isVite) {
return new ViteBuilder(this as Item<InlineConfig>)
}
if (this.fileConfig !== null) {
unsupportedType(this.fileConfig.type, this.isMain ? 'main' : 'renderer')
}
return null
}
}
export class Config<
M extends PossibleConfiguration,
R extends PossibleConfiguration,
> {
readonly main: Item<M, EnvConfig>
readonly renderer: Item<R | null>
constructor({
main,
renderer,
}: {
main: Item<M, EnvConfig>
renderer: Item<R | null>
}) {
this.main = main
this.renderer = renderer
}
toBuilders(): readonly [Builder, Builder | null] {
return [this.main.toBuilder() as Builder, this.renderer.toBuilder()]
}
} tsup's dtsimport '../builder';
export { C as Config, E as EnvConfig, I as Item } from '../config-57276ad7';
import './enums';
import './types';
import 'esbuild';
import 'vite';
import 'webpack';
import { Builder } from './builder';
import { TypeConfig, Target } from './config/enums';
import { ConfigMapping, PossibleConfiguration } from './config/types';
interface Configurator<P extends TypeConfig> {
readonly type: TypeConfig;
readonly config: EnvConfig;
toBuilderConfig(partial: Partial<ConfigMapping[P]>, config: ConfigMapping[P], target: Target): ConfigMapping[P];
}
declare type YamlItem = {
type: TypeConfig;
path: string;
src: string;
output: string;
html?: string;
};
declare type YamlSkeleton = {
mainConfig: YamlItem;
rendererConfig: YamlItem | null;
};
declare class Yaml {
readonly main: EnvConfig;
readonly renderer: EnvConfig | null;
constructor({ main, renderer, }: {
main: EnvConfig;
renderer: EnvConfig | null;
});
}
declare class EnvConfig {
readonly type: TypeConfig;
readonly path: string;
readonly src: string;
readonly output: string;
readonly html?: string;
constructor({ type, path, src, output, html, }: {
type: TypeConfig;
path: string;
src: string;
output: string;
html?: string;
});
static fromYaml(yaml: YamlItem): EnvConfig;
toConfigurator(): Configurator<TypeConfig>;
}
declare class Item<T extends PossibleConfiguration | null = PossibleConfiguration, F extends EnvConfig | null = EnvConfig | null> {
readonly config: T;
readonly fileConfig: F;
readonly target: Target;
readonly isVite: boolean;
readonly isWebpack: boolean;
readonly isEsbuild: boolean;
readonly isMain: boolean;
readonly isRenderer: boolean;
constructor({ config, fileConfig, target, }: {
config: T;
fileConfig: F;
target: Target;
});
toBuilder(): Builder | null;
}
declare class Config<M extends PossibleConfiguration, R extends PossibleConfiguration> {
readonly main: Item<M, EnvConfig>;
readonly renderer: Item<R | null>;
constructor({ main, renderer, }: {
main: Item<M, EnvConfig>;
renderer: Item<R | null>;
});
toBuilders(): readonly [Builder, Builder | null];
}
export { Config as C, EnvConfig as E, Item as I, Yaml as Y, Configurator as a, YamlSkeleton as b, YamlItem as c }; tsc's dtsimport { Builder } from '../builder';
import { Configurator } from './configurators/base.configurator';
import { Target, TypeConfig } from './enums';
import { PossibleConfiguration } from './types';
import { YamlItem } from './yaml';
export declare class EnvConfig {
readonly type: TypeConfig;
readonly path: string;
readonly src: string;
readonly output: string;
readonly html?: string;
constructor({ type, path, src, output, html, }: {
type: TypeConfig;
path: string;
src: string;
output: string;
html?: string;
});
static fromYaml(yaml: YamlItem): EnvConfig;
toConfigurator(): Configurator<TypeConfig>;
}
export declare class Item<T extends PossibleConfiguration | null = PossibleConfiguration, F extends EnvConfig | null = EnvConfig | null> {
readonly config: T;
readonly fileConfig: F;
readonly target: Target;
readonly isVite: boolean;
readonly isWebpack: boolean;
readonly isEsbuild: boolean;
readonly isMain: boolean;
readonly isRenderer: boolean;
constructor({ config, fileConfig, target, }: {
config: T;
fileConfig: F;
target: Target;
});
toBuilder(): Builder | null;
}
export declare class Config<M extends PossibleConfiguration, R extends PossibleConfiguration> {
readonly main: Item<M, EnvConfig>;
readonly renderer: Item<R | null>;
constructor({ main, renderer, }: {
main: Item<M, EnvConfig>;
renderer: Item<R | null>;
});
toBuilders(): readonly [Builder, Builder | null];
} Why tsup emit a |
This is only an issue on v5.11.8.
src/index.ts
:dist/index.d.ts
:expected
dist/index.d.ts
(emitted on v5.11.7):tsup config:
The text was updated successfully, but these errors were encountered: