Skip to content

Commit 4b7130e

Browse files
committed
merge main
2 parents 888fc31 + 7f473f6 commit 4b7130e

File tree

141 files changed

+534
-204
lines changed

Some content is hidden

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

141 files changed

+534
-204
lines changed

.changeset/few-horses-wink.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: use function declaration for snippets in server output to avoid TDZ violation

documentation/docs/98-reference/21-svelte-reactivity.md

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,6 @@
22
title: svelte/reactivity
33
---
44

5-
Svelte provides reactive versions of various built-ins like `SvelteMap`, `SvelteSet` and `SvelteURL`. These can be imported from `svelte/reactivity` and used just like their native counterparts.
6-
7-
```svelte
8-
<script>
9-
import { SvelteURL } from 'svelte/reactivity';
10-
11-
const url = new SvelteURL('https://example.com/path');
12-
</script>
13-
14-
<!-- changes to these... -->
15-
<input bind:value={url.protocol} />
16-
<input bind:value={url.hostname} />
17-
<input bind:value={url.pathname} />
18-
19-
<hr />
20-
21-
<!-- will update `href` and vice versa -->
22-
<input bind:value={url.href} />
23-
```
5+
Svelte provides reactive versions of various built-ins like [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map), [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) and [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL) that can be used just like their native counterparts, as well as a handful of additional utilities for handling reactivity.
246

257
> MODULE: svelte/reactivity

packages/svelte/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# svelte
22

3+
## 5.27.2
4+
5+
### Patch Changes
6+
7+
- chore: use pkg.imports for common modules ([#15787](https://github.com/sveltejs/svelte/pull/15787))
8+
39
## 5.27.1
410

511
### Patch Changes

packages/svelte/package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "svelte",
33
"description": "Cybernetically enhanced web apps",
44
"license": "MIT",
5-
"version": "5.27.1",
5+
"version": "5.27.2",
66
"type": "module",
77
"types": "./types/index.d.ts",
88
"engines": {
@@ -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/migrate/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @import { VariableDeclarator, Node, Identifier, AssignmentExpression, LabeledStatement, ExpressionStatement } from 'estree' */
22
/** @import { Visitors } from 'zimmerframe' */
33
/** @import { ComponentAnalysis } from '../phases/types.js' */
4-
/** @import { Scope, ScopeRoot } from '../phases/scope.js' */
4+
/** @import { Scope } from '../phases/scope.js' */
55
/** @import { AST, Binding, ValidatedCompileOptions } from '#compiler' */
66
import MagicString from 'magic-string';
77
import { walk } from 'zimmerframe';

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import { walk } from 'zimmerframe';
66
import * as e from '../../errors.js';
77
import * as w from '../../warnings.js';
8-
import { extract_identifiers, is_text_attribute } from '../../utils/ast.js';
9-
import * as b from '../../utils/builders.js';
8+
import { extract_identifiers } from '../../utils/ast.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
import { create_expression_metadata } from '../../nodes.js';
1111

1212
/**

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
/** @import { ExportNamedDeclaration, Identifier, Node } from 'estree' */
2-
/** @import { Binding } from '#compiler' */
1+
/** @import { ExportNamedDeclaration, Identifier } from 'estree' */
32
/** @import { Context } from '../types' */
4-
/** @import { Scope } from '../../scope' */
53
import * as e from '../../../errors.js';
64
import { extract_identifiers } from '../../../utils/ast.js';
75

0 commit comments

Comments
 (0)