Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
privatenumber committed Jul 19, 2024
1 parent 0ea989b commit 7eba8d5
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 129 deletions.
3 changes: 2 additions & 1 deletion src/utils/get-rollup-configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const getConfig = {
tsconfig: TsConfigResult | null,
) => {
const dts = await import('rollup-plugin-dts');

const ts = await import('typescript');

Check warning on line 47 in src/utils/get-rollup-configs.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

Maximum number of dependencies (15) exceeded
return {
input: [] as string[],
preserveEntrySignatures: 'strict' as const,
Expand Down Expand Up @@ -75,6 +75,7 @@ const getConfig = {
compilerOptions: {
composite: false,
preserveSymlinks: false,
moduleResolution: ts.default.ModuleResolutionKind.Bundler,
},
}) as Plugin,
],
Expand Down
1 change: 0 additions & 1 deletion tests/specs/builds/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default testSuite(({ describe }, nodePath: string) => {
runTestSuite(import('./bin.js'), nodePath);
runTestSuite(import('./dependencies.js'), nodePath);
runTestSuite(import('./src-dist.js'), nodePath);
runTestSuite(import('./symlink.js'), nodePath);
runTestSuite(import('./sourcemap.js'), nodePath);
runTestSuite(import('./typescript.js'), nodePath);
runTestSuite(import('./clean-dist.js'), nodePath);

Check warning on line 19 in tests/specs/builds/index.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

Maximum number of dependencies (15) exceeded
Expand Down
40 changes: 40 additions & 0 deletions tests/specs/builds/output-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,5 +309,45 @@ export default testSuite(({ describe }, nodePath: string) => {
const contentTwo = await fixture.readFile('packages/two/dist/index.mjs', 'utf8');
expect(contentTwo).toMatch('export { sayHello };');
});

test('symlinks', async () => {
await using fixture = await createFixture({
...installTypeScript,
'package.json': createPackageJson({
types: './dist/index.d.ts',
peerDependencies: {
'dep-a': '*',
},
}),
'src/index.ts': `
import { fn } from 'dep-a';
export default fn({ value: 1 });
`,
node_modules: {
'dep-a/index.d.ts': ({ symlink }) => symlink('../../store/dep-a/index.d.ts'),
},
store: {
'dep-a': {
'node_modules/dep-b/index.d.ts': `
type data = {
value: number;
};
export declare function fn(a: data): data;
`,
'index.d.ts': 'export * from \'dep-b\';',
},
},
});

const pkgrollOne = await pkgroll([], {
cwd: fixture.path,
nodePath,
});
expect(pkgrollOne.stderr).toBe('');

const types = await fixture.readFile('dist/index.d.ts', 'utf8');
expect(types).toMatch('\'dep-a\'');
expect(types).toMatch('.data');
});
});
});
127 changes: 0 additions & 127 deletions tests/specs/builds/symlink.ts

This file was deleted.

0 comments on commit 7eba8d5

Please sign in to comment.