Skip to content

Commit 28d4abb

Browse files
committed
merge main
2 parents 6ff5a06 + 8808860 commit 28d4abb

File tree

10 files changed

+109
-42
lines changed

10 files changed

+109
-42
lines changed

.changeset/pre.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@
262262
"orange-dingos-poke",
263263
"orange-yaks-protect",
264264
"pink-bikes-agree",
265+
"pink-goats-promise",
265266
"pink-mayflies-tie",
266267
"plenty-starfishes-dress",
267268
"polite-dolphins-care",

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.0.0-next.114
4+
5+
### Patch Changes
6+
7+
- feat: introduce types to express bindability ([#11225](https://github.com/sveltejs/svelte/pull/11225))
8+
39
## 5.0.0-next.113
410

511
### Patch Changes
Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1-
## missing_custom_element_compile_option
1+
## options_deprecated_accessors
22

3-
The 'customElement' option is used when generating a custom element. Did you forget the 'customElement: true' compile option?
3+
The `accessors` option has been deprecated. It will have no effect in runes mode
4+
5+
## options_deprecated_immutable
6+
7+
The `immutable` option has been deprecated. It will have no effect in runes mode
8+
9+
## options_missing_custom_element
10+
11+
The `customElement` option is used when generating a custom element. Did you forget the `customElement: true` compile option?
12+
13+
## options_renamed_ssr_dom
14+
15+
`generate: "dom"` and `generate: "ssr"` options have been renamed to "client" and "server" respectively
16+
17+
## options_removed_enable_sourcemap
18+
19+
The `enableSourcemap` option has been removed. Source maps are always generated now, and tooling can choose to ignore them
20+
21+
## options_removed_hydratable
22+
23+
The `hydratable` option has been removed. Svelte components are always hydratable now
24+
25+
## options_removed_loop_guard_timeout
26+
27+
The `loopGuardTimeout` option has been removed

packages/svelte/package.json

Lines changed: 1 addition & 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.0.0-next.113",
5+
"version": "5.0.0-next.114",
66
"type": "module",
77
"types": "./types/index.d.ts",
88
"engines": {

packages/svelte/scripts/process-messages/templates/compile-warnings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function reset_warnings(options) {
3131
*/
3232
function w(node, code, message) {
3333
// @ts-expect-error
34-
if (node.ignores?.has(code)) return;
34+
if (node?.ignores?.has(code)) return;
3535

3636
warnings.push({
3737
code,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ export function analyze_component(root, source, options) {
402402
}
403403

404404
if (attribute.name === 'customElement' && !options.customElement) {
405-
w.missing_custom_element_compile_option(attribute);
405+
w.options_missing_custom_element(root.options);
406406
}
407407

408408
if (attribute.name === 'immutable') {

packages/svelte/src/compiler/validate-options.js

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as e from './errors.js';
2+
import * as w from './warnings.js';
23

34
/**
45
* @template [Input=any]
@@ -13,9 +14,7 @@ const common = {
1314

1415
generate: validator('client', (input, keypath) => {
1516
if (input === 'dom' || input === 'ssr') {
16-
warn(
17-
'`generate: "dom"` and `generate: "ssr"` options have been renamed to "client" and "server" respectively'
18-
);
17+
warn_once(w.options_renamed_ssr_dom);
1918
return input === 'dom' ? 'client' : 'server';
2019
}
2120

@@ -40,10 +39,7 @@ export const validate_component_options =
4039
object({
4140
...common,
4241

43-
accessors: deprecate(
44-
'The accessors option has been deprecated. It will have no effect in runes mode.',
45-
boolean(false)
46-
),
42+
accessors: deprecate(w.options_deprecated_accessors, boolean(false)),
4743

4844
css: validator('external', (input) => {
4945
if (input === true || input === false) {
@@ -75,16 +71,13 @@ export const validate_component_options =
7571

7672
discloseVersion: boolean(true),
7773

78-
immutable: deprecate(
79-
'The immutable option has been deprecated. It will have no effect in runes mode.',
80-
boolean(false)
81-
),
74+
immutable: deprecate(w.options_deprecated_immutable, boolean(false)),
8275

8376
legacy: object({
8477
componentApi: boolean(false)
8578
}),
8679

87-
loopGuardTimeout: warn_removed('The loopGuardTimeout option has been removed.'),
80+
loopGuardTimeout: warn_removed(w.options_removed_loop_guard_timeout),
8881

8982
name: string(undefined),
9083

@@ -106,12 +99,8 @@ export const validate_component_options =
10699
return input;
107100
}),
108101

109-
enableSourcemap: warn_removed(
110-
'The enableSourcemap option has been removed. Source maps are always generated now, and tooling can choose to ignore them.'
111-
),
112-
hydratable: warn_removed(
113-
'The hydratable option has been removed. Svelte components are always hydratable now.'
114-
),
102+
enableSourcemap: warn_removed(w.options_removed_enable_sourcemap),
103+
hydratable: warn_removed(w.options_removed_hydratable),
115104
format: removed(
116105
'The format option has been removed in Svelte 4, the compiler only outputs ESM now. Remove "format" from your compiler options. ' +
117106
'If you did not set this yourself, bump the version of your bundler plugin (vite-plugin-svelte/rollup-plugin-svelte/svelte-loader)'
@@ -152,34 +141,33 @@ function removed(msg) {
152141

153142
const warned = new Set();
154143

155-
/** @param {string} message */
156-
function warn(message) {
157-
if (!warned.has(message)) {
158-
warned.add(message);
159-
// eslint-disable-next-line no-console
160-
console.warn(message);
144+
/** @param {(node: null) => void} fn */
145+
function warn_once(fn) {
146+
if (!warned.has(fn)) {
147+
warned.add(fn);
148+
fn(null);
161149
}
162150
}
163151

164152
/**
165-
* @param {string} message
153+
* @param {(node: null) => void} fn
166154
* @returns {Validator}
167155
*/
168-
function warn_removed(message) {
156+
function warn_removed(fn) {
169157
return (input) => {
170-
if (input !== undefined) warn(message);
158+
if (input !== undefined) warn_once(fn);
171159
return /** @type {any} */ (undefined);
172160
};
173161
}
174162

175163
/**
176-
* @param {string} message
164+
* @param {(node: null) => void} fn
177165
* @param {Validator} validator
178166
* @returns {Validator}
179167
*/
180-
function deprecate(message, validator) {
168+
function deprecate(fn, validator) {
181169
return (input, keypath) => {
182-
if (input !== undefined) warn(message);
170+
if (input !== undefined) warn_once(fn);
183171
return validator(input, keypath);
184172
};
185173
}

packages/svelte/src/compiler/warnings.js

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function reset_warnings(options) {
2929
*/
3030
function w(node, code, message) {
3131
// @ts-expect-error
32-
if (node.ignores?.has(code)) return;
32+
if (node?.ignores?.has(code)) return;
3333

3434
warnings.push({
3535
code,
@@ -561,11 +561,59 @@ export function invalid_self_closing_tag(node, name) {
561561
}
562562

563563
/**
564-
* The 'customElement' option is used when generating a custom element. Did you forget the 'customElement: true' compile option?
564+
* The `accessors` option has been deprecated. It will have no effect in runes mode
565565
* @param {null | NodeLike} node
566566
*/
567-
export function missing_custom_element_compile_option(node) {
568-
w(node, "missing_custom_element_compile_option", "The 'customElement' option is used when generating a custom element. Did you forget the 'customElement: true' compile option?");
567+
export function options_deprecated_accessors(node) {
568+
w(node, "options_deprecated_accessors", "The `accessors` option has been deprecated. It will have no effect in runes mode");
569+
}
570+
571+
/**
572+
* The `immutable` option has been deprecated. It will have no effect in runes mode
573+
* @param {null | NodeLike} node
574+
*/
575+
export function options_deprecated_immutable(node) {
576+
w(node, "options_deprecated_immutable", "The `immutable` option has been deprecated. It will have no effect in runes mode");
577+
}
578+
579+
/**
580+
* The `customElement` option is used when generating a custom element. Did you forget the `customElement: true` compile option?
581+
* @param {null | NodeLike} node
582+
*/
583+
export function options_missing_custom_element(node) {
584+
w(node, "options_missing_custom_element", "The `customElement` option is used when generating a custom element. Did you forget the `customElement: true` compile option?");
585+
}
586+
587+
/**
588+
* `generate: "dom"` and `generate: "ssr"` options have been renamed to "client" and "server" respectively
589+
* @param {null | NodeLike} node
590+
*/
591+
export function options_renamed_ssr_dom(node) {
592+
w(node, "options_renamed_ssr_dom", "`generate: \"dom\"` and `generate: \"ssr\"` options have been renamed to \"client\" and \"server\" respectively");
593+
}
594+
595+
/**
596+
* The `enableSourcemap` option has been removed. Source maps are always generated now, and tooling can choose to ignore them
597+
* @param {null | NodeLike} node
598+
*/
599+
export function options_removed_enable_sourcemap(node) {
600+
w(node, "options_removed_enable_sourcemap", "The `enableSourcemap` option has been removed. Source maps are always generated now, and tooling can choose to ignore them");
601+
}
602+
603+
/**
604+
* The `hydratable` option has been removed. Svelte components are always hydratable now
605+
* @param {null | NodeLike} node
606+
*/
607+
export function options_removed_hydratable(node) {
608+
w(node, "options_removed_hydratable", "The `hydratable` option has been removed. Svelte components are always hydratable now");
609+
}
610+
611+
/**
612+
* The `loopGuardTimeout` option has been removed
613+
* @param {null | NodeLike} node
614+
*/
615+
export function options_removed_loop_guard_timeout(node) {
616+
w(node, "options_removed_loop_guard_timeout", "The `loopGuardTimeout` option has been removed");
569617
}
570618

571619
/**

packages/svelte/src/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
* https://svelte.dev/docs/svelte-compiler#svelte-version
77
* @type {string}
88
*/
9-
export const VERSION = '5.0.0-next.113';
9+
export const VERSION = '5.0.0-next.114';
1010
export const PUBLIC_VERSION = '5';

packages/svelte/tests/validator/samples/tag-custom-element-options-missing/warnings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
3-
"code": "missing_custom_element_compile_option",
4-
"message": "The 'customElement' option is used when generating a custom element. Did you forget the 'customElement: true' compile option?",
3+
"code": "options_missing_custom_element",
4+
"message": "The `customElement` option is used when generating a custom element. Did you forget the `customElement: true` compile option?",
55
"start": {
66
"line": 1,
77
"column": 16

0 commit comments

Comments
 (0)