Skip to content
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

fix(types): add exports for old ts import style #6263

Merged
merged 1 commit into from
May 7, 2024
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/qwik/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@
"core.prod.cjs",
"core.prod.mjs",
"core.d.ts",
"index.d.ts",
"jsx-dev-runtime/package.json",
"jsx-runtime/package.json",
"jsx-runtime/index.d.ts",
"jsx-runtime.d.ts",
"loader/index.cjs",
"loader/index.mjs",
Expand Down
11 changes: 10 additions & 1 deletion scripts/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Extractor, ExtractorConfig } from '@microsoft/api-extractor';
import { readFileSync, writeFileSync } from 'node:fs';
import { join } from 'node:path';
import { generateQwikApiMarkdownDocs, generateQwikCityApiMarkdownDocs } from './api-docs';
import { type BuildConfig, panic, copyFile } from './util';
import { type BuildConfig, panic, copyFile, ensureDir } from './util';

/**
* Create each submodule's bundled dts file, and ensure the public API has not changed for a
Expand All @@ -17,13 +17,22 @@ export async function apiExtractorQwik(config: BuildConfig) {
join(config.distQwikPkgDir, 'core.d.ts'),
'.'
);
writeFileSync(
join(config.distQwikPkgDir, 'index.d.ts'),
`// re-export to make TS happy when not using nodenext import resolution\nexport * from './core';`
);
// Special case for jsx-runtime:
// It only re-exports JSX. Don't duplicate the types
const jsxContent = readFileSync(join(config.srcQwikDir, 'jsx-runtime.ts'), 'utf-8');
writeFileSync(
join(config.distQwikPkgDir, 'jsx-runtime.d.ts'),
`// re-export to make TS happy when not using nodenext import resolution\n${jsxContent}`
);
ensureDir(join(config.distQwikPkgDir, 'jsx-runtime'));
writeFileSync(
join(config.distQwikPkgDir, 'jsx-runtime', 'index.d.ts'),
`// re-export to make TS happy when not using nodenext import resolution\nexport * from '../jsx-runtime';`
);
createTypesApi(
config,
join(config.srcQwikDir, 'optimizer'),
Expand Down
Loading