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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tools/generators/migrate-converged-pkg/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,7 @@ describe('migrate-converged-pkg generator', () => {
Object {
".": Object {
"import": "./lib/index.js",
"node": "./lib-commonjs/index.js",
"require": "./lib-commonjs/index.js",
"types": "./dist/index.d.ts",
},
Expand Down Expand Up @@ -1300,6 +1301,7 @@ describe('migrate-converged-pkg generator', () => {
expect(pkgJson.exports['./unstable']).toMatchInlineSnapshot(`
Object {
"import": "./lib/unstable/index.js",
"node": "./lib-commonjs/unstable/index.js",
"require": "./lib-commonjs/unstable/index.js",
"types": "./dist/unstable.d.ts",
}
Expand Down
2 changes: 2 additions & 0 deletions tools/generators/migrate-converged-pkg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ function setupUnstableApi(tree: Tree, options: NormalizedSchemaWithTsConfigs) {
Object.assign(stableJson.exports, {
'./unstable': {
types: unstableJson.typings?.replace(/\.\.\//g, ''),
...(packageJson.main ? { node: './lib-commonjs/unstable/index.js' } : null),
...(packageJson.module ? { import: './lib/unstable/index.js' } : null),
require: './lib-commonjs/unstable/index.js',
},
Expand Down Expand Up @@ -660,6 +661,7 @@ function updatePackageJson(tree: Tree, options: NormalizedSchemaWithTsConfigs) {
json.exports = {
'.': {
types: json.typings,
...(json.main ? { node: normalizePackageEntryPointPaths(json.main) } : null),
...(json.module ? { import: normalizePackageEntryPointPaths(json.module) } : null),
...(json.main ? { require: normalizePackageEntryPointPaths(json.main) } : null),
},
Expand Down
2 changes: 1 addition & 1 deletion tools/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface PackageJson {
dependencies?: Record<string, string>;
devDependencies?: Record<string, string>;
peerDependencies?: Record<string, string>;
exports?: Record<string, string | Partial<{ types: string; import: string; require: string }>>;
exports?: Record<string, string | Partial<{ types: string; node: string; import: string; require: string }>>;
}

export interface PackageJsonWithBeachball extends PackageJson {
Expand Down