1
+ /** @import { LegacyRoot } from './types/legacy-nodes.js' */
2
+ /** @import { CompileOptions, CompileResult, ValidatedCompileOptions, ModuleCompileOptions, Root } from '#compiler' */
1
3
import { walk as zimmerframe_walk } from 'zimmerframe' ;
2
4
import { convert } from './legacy.js' ;
3
5
import { parse as parse_acorn } from './phases/1-parse/acorn.js' ;
@@ -14,8 +16,8 @@ export { default as preprocess } from './preprocess/index.js';
14
16
*
15
17
* https://svelte.dev/docs/svelte-compiler#svelte-compile
16
18
* @param {string } source The component source code
17
- * @param {import('#compiler'). CompileOptions } options The compiler options
18
- * @returns {import('#compiler'). CompileResult }
19
+ * @param {CompileOptions } options The compiler options
20
+ * @returns {CompileResult }
19
21
*/
20
22
export function compile ( source , options ) {
21
23
const validated = validate_component_options ( options , '' ) ;
@@ -25,7 +27,7 @@ export function compile(source, options) {
25
27
26
28
const { customElement : customElementOptions , ...parsed_options } = parsed . options || { } ;
27
29
28
- /** @type {import('#compiler'). ValidatedCompileOptions } */
30
+ /** @type {ValidatedCompileOptions } */
29
31
const combined_options = {
30
32
...validated ,
31
33
...parsed_options ,
@@ -52,8 +54,8 @@ export function compile(source, options) {
52
54
*
53
55
* https://svelte.dev/docs/svelte-compiler#svelte-compile
54
56
* @param {string } source The component source code
55
- * @param {import('#compiler'). ModuleCompileOptions } options
56
- * @returns {import('#compiler'). CompileResult }
57
+ * @param {ModuleCompileOptions } options
58
+ * @returns {CompileResult }
57
59
*/
58
60
export function compileModule ( source , options ) {
59
61
const validated = validate_module_options ( options , '' ) ;
@@ -73,7 +75,7 @@ export function compileModule(source, options) {
73
75
* @overload
74
76
* @param {string } source
75
77
* @param {{ filename?: string; modern: true } } options
76
- * @returns {import('#compiler'). Root }
78
+ * @returns {Root }
77
79
*/
78
80
79
81
/**
@@ -86,7 +88,7 @@ export function compileModule(source, options) {
86
88
* @overload
87
89
* @param {string } source
88
90
* @param {{ filename?: string; modern?: false } } [options]
89
- * @returns {import('./types/legacy-nodes.js'). LegacyRoot }
91
+ * @returns {LegacyRoot }
90
92
*/
91
93
92
94
/**
@@ -98,7 +100,7 @@ export function compileModule(source, options) {
98
100
* https://svelte.dev/docs/svelte-compiler#svelte-parse
99
101
* @param {string } source
100
102
* @param {{ filename?: string; rootDir?: string; modern?: boolean } } [options]
101
- * @returns {import('#compiler'). Root | import('./types/legacy-nodes.js'). LegacyRoot }
103
+ * @returns {Root | LegacyRoot }
102
104
*/
103
105
export function parse ( source , { filename, rootDir, modern } = { } ) {
104
106
state . reset ( source , { filename, rootDir } ) ; // TODO it's weird to require filename/rootDir here. reconsider the API
@@ -109,7 +111,7 @@ export function parse(source, { filename, rootDir, modern } = {}) {
109
111
110
112
/**
111
113
* @param {string } source
112
- * @param {import('#compiler'). Root } ast
114
+ * @param {Root } ast
113
115
* @param {boolean | undefined } modern
114
116
*/
115
117
function to_public_ast ( source , ast , modern ) {
0 commit comments