-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] merge packaging exports (#2327)
- Loading branch information
1 parent
621e071
commit fe642d2
Showing
32 changed files
with
216 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@sveltejs/kit': patch | ||
--- | ||
|
||
packaging merge exports field by default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/kit/src/packaging/test/fixtures/exports-merge/expected/Test.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<script> | ||
import { createEventDispatcher } from 'svelte'; | ||
/** | ||
* @type {string} | ||
*/ | ||
export const astring; | ||
const dispatch = createEventDispatcher(); | ||
dispatch('event', true); | ||
</script> | ||
|
||
<slot {astring} /> |
40 changes: 40 additions & 0 deletions
40
packages/kit/src/packaging/test/fixtures/exports-merge/expected/Test.svelte.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** @typedef {typeof __propDef.props} TestProps */ | ||
/** @typedef {typeof __propDef.events} TestEvents */ | ||
/** @typedef {typeof __propDef.slots} TestSlots */ | ||
export default class Test extends SvelteComponentTyped< | ||
{ | ||
astring: string; | ||
}, | ||
{ | ||
event: CustomEvent<any>; | ||
} & { | ||
[evt: string]: CustomEvent<any>; | ||
}, | ||
{ | ||
default: { | ||
astring: string; | ||
}; | ||
} | ||
> { | ||
get astring(): string; | ||
} | ||
export type TestProps = typeof __propDef.props; | ||
export type TestEvents = typeof __propDef.events; | ||
export type TestSlots = typeof __propDef.slots; | ||
import { SvelteComponentTyped } from 'svelte'; | ||
declare const __propDef: { | ||
props: { | ||
astring: string; | ||
}; | ||
events: { | ||
event: CustomEvent<any>; | ||
} & { | ||
[evt: string]: CustomEvent<any>; | ||
}; | ||
slots: { | ||
default: { | ||
astring: string; | ||
}; | ||
}; | ||
}; | ||
export {}; |
1 change: 1 addition & 0 deletions
1
packages/kit/src/packaging/test/fixtures/exports-merge/expected/index.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as Test } from './Test.svelte'; |
1 change: 1 addition & 0 deletions
1
packages/kit/src/packaging/test/fixtures/exports-merge/expected/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as Test } from './Test.svelte'; |
6 changes: 6 additions & 0 deletions
6
packages/kit/src/packaging/test/fixtures/exports-merge/expected/internal/Test.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<script> | ||
/** | ||
* @type {import('./foo').Foo} | ||
*/ | ||
export let foo; | ||
</script> |
26 changes: 26 additions & 0 deletions
26
packages/kit/src/packaging/test/fixtures/exports-merge/expected/internal/Test.svelte.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** @typedef {typeof __propDef.props} TestProps */ | ||
/** @typedef {typeof __propDef.events} TestEvents */ | ||
/** @typedef {typeof __propDef.slots} TestSlots */ | ||
export default class Test extends SvelteComponentTyped< | ||
{ | ||
foo: boolean; | ||
}, | ||
{ | ||
[evt: string]: CustomEvent<any>; | ||
}, | ||
{} | ||
> {} | ||
export type TestProps = typeof __propDef.props; | ||
export type TestEvents = typeof __propDef.events; | ||
export type TestSlots = typeof __propDef.slots; | ||
import { SvelteComponentTyped } from 'svelte'; | ||
declare const __propDef: { | ||
props: { | ||
foo: import('./foo').Foo; | ||
}; | ||
events: { | ||
[evt: string]: CustomEvent<any>; | ||
}; | ||
slots: {}; | ||
}; | ||
export {}; |
1 change: 1 addition & 0 deletions
1
packages/kit/src/packaging/test/fixtures/exports-merge/expected/internal/_Private.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is a private component and should be excluded |
15 changes: 15 additions & 0 deletions
15
...ages/kit/src/packaging/test/fixtures/exports-merge/expected/internal/_Private.svelte.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** @typedef {typeof __propDef.props} PrivateProps */ | ||
/** @typedef {typeof __propDef.events} PrivateEvents */ | ||
/** @typedef {typeof __propDef.slots} PrivateSlots */ | ||
export default class Private {} | ||
export type PrivateProps = typeof __propDef.props; | ||
export type PrivateEvents = typeof __propDef.events; | ||
export type PrivateSlots = typeof __propDef.slots; | ||
declare const __propDef: { | ||
props: {}; | ||
events: { | ||
[evt: string]: CustomEvent<any>; | ||
}; | ||
slots: {}; | ||
}; | ||
export {}; |
Empty file.
Empty file.
1 change: 1 addition & 0 deletions
1
packages/kit/src/packaging/test/fixtures/exports-merge/expected/internal/foo.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type Foo = boolean; |
17 changes: 17 additions & 0 deletions
17
packages/kit/src/packaging/test/fixtures/exports-merge/expected/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "exports-replace", | ||
"version": "1.0.0", | ||
"description": "merges exports field", | ||
"exports": { | ||
"./internal/constants.js": "./internal/constants.js", | ||
"./internal/Test.svelte": "./internal/Test.svelte", | ||
"./Test.svelte": "./Test.svelte", | ||
".": { | ||
"import": "./index.js" | ||
}, | ||
"./constants": "./internal/constants.js", | ||
"./Test": "./Test.svelte", | ||
"./package.json": "./package.json" | ||
}, | ||
"type": "module" | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/kit/src/packaging/test/fixtures/exports-merge/jsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"checkJs": true, | ||
"baseUrl": ".", | ||
"paths": { | ||
"$lib/*": ["src/lib/*"] | ||
} | ||
}, | ||
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"] | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/kit/src/packaging/test/fixtures/exports-merge/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "exports-replace", | ||
"version": "1.0.0", | ||
"description": "merges exports field", | ||
"exports": { | ||
".": { | ||
"import": "./index.js" | ||
}, | ||
"./constants": "./internal/constants.js", | ||
"./Test": "./Test.svelte" | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/kit/src/packaging/test/fixtures/exports-merge/src/app.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
%svelte.head% | ||
</head> | ||
<body> | ||
<div id="svelte">%svelte.body%</div> | ||
</body> | ||
</html> |
12 changes: 12 additions & 0 deletions
12
packages/kit/src/packaging/test/fixtures/exports-merge/src/lib/Test.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<script> | ||
import { createEventDispatcher } from 'svelte'; | ||
/** | ||
* @type {string} | ||
*/ | ||
export const astring; | ||
const dispatch = createEventDispatcher(); | ||
dispatch('event', true); | ||
</script> | ||
|
||
<slot {astring} /> |
1 change: 1 addition & 0 deletions
1
packages/kit/src/packaging/test/fixtures/exports-merge/src/lib/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as Test } from './Test.svelte'; |
6 changes: 6 additions & 0 deletions
6
packages/kit/src/packaging/test/fixtures/exports-merge/src/lib/internal/Test.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<script> | ||
/** | ||
* @type {import('./foo').Foo} | ||
*/ | ||
export let foo; | ||
</script> |
1 change: 1 addition & 0 deletions
1
packages/kit/src/packaging/test/fixtures/exports-merge/src/lib/internal/_Private.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is a private component and should be excluded |
Empty file.
1 change: 1 addition & 0 deletions
1
packages/kit/src/packaging/test/fixtures/exports-merge/src/lib/internal/foo.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type Foo = boolean; |
Empty file.
6 changes: 3 additions & 3 deletions
6
packages/kit/src/packaging/test/fixtures/exports-replace/expected/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
{ | ||
"name": "exports-replace", | ||
"version": "1.0.0", | ||
"description": "default exports settings", | ||
"description": "replaces exports field", | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"import": "./index.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"type": "module" | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
packages/kit/src/packaging/test/fixtures/exports-replace/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** @type {import('@sveltejs/kit').Config} */ | ||
const config = { | ||
kit: { | ||
package: { | ||
exports: { | ||
exclude: ['**'] | ||
} | ||
} | ||
} | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters