Skip to content

Commit 4f8708a

Browse files
authored
chore: use pkg.imports for builder.js (#15785)
* chore: use pkg.imports for builder.js * use pkg.imports instead of tsconfig * #client/constants
1 parent 262b281 commit 4f8708a

File tree

111 files changed

+127
-113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+127
-113
lines changed

packages/svelte/package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,17 @@
103103
"default": "./src/events/index.js"
104104
}
105105
},
106+
"imports": {
107+
"#client": "./src/internal/client/types.d.ts",
108+
"#client/constants": "./src/internal/client/constants.js",
109+
"#compiler": {
110+
"types": "./src/compiler/private.d.ts",
111+
"default": "./src/compiler/index.js"
112+
},
113+
"#compiler/builders": "./src/compiler/utils/builders.js",
114+
"#server": "./src/internal/server/types.d.ts",
115+
"#shared": "./src/internal/shared/types.d.ts"
116+
},
106117
"repository": {
107118
"type": "git",
108119
"url": "git+https://github.com/sveltejs/svelte.git",

packages/svelte/scripts/generate-types.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ await createBundle({
2424
output: `${dir}/types/index.d.ts`,
2525
compilerOptions: {
2626
// so that types/properties with `@internal` (and its dependencies) are removed from the output
27-
stripInternal: true
27+
stripInternal: true,
28+
paths: Object.fromEntries(
29+
Object.entries(pkg.imports).map(([key, value]) => {
30+
return [key, [value.types ?? value.default ?? value]];
31+
})
32+
)
2833
},
2934
modules: {
3035
[pkg.name]: `${dir}/src/index.d.ts`,

packages/svelte/src/compiler/phases/1-parse/remove_typescript_nodes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @import { Context, Visitors } from 'zimmerframe' */
22
/** @import { FunctionExpression, FunctionDeclaration } from 'estree' */
33
import { walk } from 'zimmerframe';
4-
import * as b from '../../utils/builders.js';
4+
import * as b from '#compiler/builders';
55
import * as e from '../../errors.js';
66

77
/**

packages/svelte/src/compiler/phases/2-analyze/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { walk } from 'zimmerframe';
66
import * as e from '../../errors.js';
77
import * as w from '../../warnings.js';
88
import { extract_identifiers } from '../../utils/ast.js';
9-
import * as b from '../../utils/builders.js';
9+
import * as b from '#compiler/builders';
1010
import { Scope, ScopeRoot, create_scopes, get_rune, set_scope } from '../scope.js';
1111
import check_graph_for_cycles from './utils/check_graph_for_cycles.js';
1212
import { create_attribute, is_custom_element_node } from '../nodes.js';

packages/svelte/src/compiler/phases/2-analyze/visitors/CallExpression.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as e from '../../../errors.js';
66
import { get_parent } from '../../../utils/ast.js';
77
import { is_pure, is_safe_identifier } from './shared/utils.js';
88
import { dev, locate_node, source } from '../../../state.js';
9-
import * as b from '../../../utils/builders.js';
9+
import * as b from '#compiler/builders';
1010

1111
/**
1212
* @param {CallExpression} node

packages/svelte/src/compiler/phases/2-analyze/visitors/shared/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as e from '../../../../errors.js';
77
import { extract_identifiers } from '../../../../utils/ast.js';
88
import * as w from '../../../../warnings.js';
9-
import * as b from '../../../../utils/builders.js';
9+
import * as b from '#compiler/builders';
1010
import { get_rune } from '../../../scope.js';
1111

1212
/**

packages/svelte/src/compiler/phases/3-transform/client/transform-client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/** @import { ComponentAnalysis, Analysis } from '../../types' */
44
/** @import { Visitors, ComponentClientTransformState, ClientTransformState } from './types' */
55
import { walk } from 'zimmerframe';
6-
import * as b from '../../../utils/builders.js';
6+
import * as b from '#compiler/builders';
77
import { build_getter, is_state_source } from './utils.js';
88
import { render_stylesheet } from '../css/index.js';
99
import { dev, filename } from '../../../state.js';

packages/svelte/src/compiler/phases/3-transform/client/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/** @import { ClientTransformState, ComponentClientTransformState, ComponentContext } from './types.js' */
44
/** @import { Analysis } from '../../types.js' */
55
/** @import { Scope } from '../../scope.js' */
6-
import * as b from '../../../utils/builders.js';
6+
import * as b from '#compiler/builders';
77
import { is_simple_expression } from '../../../utils/ast.js';
88
import {
99
PROPS_IS_LAZY_INITIAL,

packages/svelte/src/compiler/phases/3-transform/client/visitors/AnimateDirective.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @import { Expression } from 'estree' */
22
/** @import { AST } from '#compiler' */
33
/** @import { ComponentContext } from '../types' */
4-
import * as b from '../../../../utils/builders.js';
4+
import * as b from '#compiler/builders';
55
import { parse_directive_name } from './shared/utils.js';
66

77
/**

packages/svelte/src/compiler/phases/3-transform/client/visitors/AssignmentExpression.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @import { AssignmentExpression, AssignmentOperator, Expression, Identifier, Pattern } from 'estree' */
22
/** @import { AST } from '#compiler' */
33
/** @import { Context } from '../types.js' */
4-
import * as b from '../../../../utils/builders.js';
4+
import * as b from '#compiler/builders';
55
import {
66
build_assignment_value,
77
get_attribute_expression,

0 commit comments

Comments
 (0)