svelte 3.44.0 → 3.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Svelte changelog
2
2
 
3
+ ## 3.45.0
4
+
5
+ * Fix non-boolean attribute rendering in SSR to render truthy values as-is ([#6121](https://github.com/sveltejs/svelte/issues/6121))
6
+ * Fix binding to a member expression also invalidating the member property ([#6921](https://github.com/sveltejs/svelte/issues/6921))
7
+ * Fix default values in `{#each}`/etc. destructurings not being considered references for the purposes of compiler warnings ([#6964](https://github.com/sveltejs/svelte/issues/6964))
8
+ * Fix `{:else if}` value incorrectly being cached ([#7043](https://github.com/sveltejs/svelte/pull/7043))
9
+ * Add `a11y-no-redundant-roles` warning ([#7067](https://github.com/sveltejs/svelte/pull/7067))
10
+ * Fix code generation error with arrow functions whose bodies are object destructuring assignments ([#7087](https://github.com/sveltejs/svelte/issues/7087))
11
+
12
+ ## 3.44.3
13
+
14
+ * Fix `bind:this` binding inside `onMount` for manually instantiated component ([#6760](https://github.com/sveltejs/svelte/issues/6760))
15
+ * Prevent cursor jumps with one-way binding for other `type="text"`-like `<input>`s ([#6941](https://github.com/sveltejs/svelte/pull/6941))
16
+ * Exclude `async` loops from `loopGuardTimeout` ([#6945](https://github.com/sveltejs/svelte/issues/6945))
17
+
18
+ ## 3.44.2
19
+
20
+ * Fix overly restrictive preprocessor types ([#6904](https://github.com/sveltejs/svelte/pull/6904))
21
+ * More specific typing for crossfade function - returns a tuple, not an array ([#6926](https://github.com/sveltejs/svelte/issues/6926))
22
+ * Add `URLSearchParams` as a known global ([#6938](https://github.com/sveltejs/svelte/pull/6938))
23
+ * Add `types` field to `exports` map ([#6939](https://github.com/sveltejs/svelte/issues/6939))
24
+
25
+ ## 3.44.1
26
+
27
+ * Fix code generation when a multi-line `return` statement contains comments ([code-red#36](https://github.com/Rich-Harris/code-red/issues/36))
28
+ * Fix code generation when `for`/`if`/`while` statements have empty bodies ([#6884](https://github.com/sveltejs/svelte/issues/6884))
29
+
3
30
  ## 3.44.0
4
31
 
5
32
  * Add `enableSourcemap` compiler option ([#6835](https://github.com/sveltejs/svelte/pull/6835))
package/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2016-21 [these people](https://github.com/sveltejs/svelte/graphs/contributors)
1
+ Copyright (c) 2016-22 [these people](https://github.com/sveltejs/svelte/graphs/contributors)
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
package/README.md CHANGED
@@ -64,7 +64,7 @@ npm run test -- -g transition
64
64
 
65
65
  ## svelte.dev
66
66
 
67
- The source code for https://svelte.dev, including all the documentation, lives in the [site](site) directory. The site is built with [Sapper](https://sapper.svelte.dev).
67
+ The source code for https://svelte.dev, including all the documentation, lives in the [site](site) directory. The site is built with [SvelteKit](https://kit.svelte.dev).
68
68
 
69
69
  ### Is svelte.dev down?
70
70
 
package/compiler.js CHANGED
@@ -6498,7 +6498,7 @@
6498
6498
  }),
6499
6499
 
6500
6500
  EmptyStatement(node, state) {
6501
- return [];
6501
+ return [c(';')];
6502
6502
  },
6503
6503
 
6504
6504
  ParenthesizedExpression(node, state) {
@@ -6604,10 +6604,11 @@
6604
6604
 
6605
6605
  ReturnStatement(node, state) {
6606
6606
  if (node.argument) {
6607
+ const contains_comment = node.argument.leadingComments && node.argument.leadingComments.some((/** @type import('../utils/comments.js').CommentWithLocation */ comment) => comment.has_trailing_newline);
6607
6608
  return [
6608
- c('return '),
6609
+ c(contains_comment ? 'return (' : 'return '),
6609
6610
  ...handle(node.argument, state),
6610
- c(';')
6611
+ c(contains_comment ? ');' : ';')
6611
6612
  ];
6612
6613
  } else {
6613
6614
  return [c('return;')];
@@ -6998,7 +6999,10 @@
6998
6999
 
6999
7000
  chunks.push(c(' => '));
7000
7001
 
7001
- if (node.body.type === 'ObjectExpression') {
7002
+ if (
7003
+ node.body.type === 'ObjectExpression' ||
7004
+ (node.body.type === 'AssignmentExpression' && node.body.left.type === 'ObjectPattern')
7005
+ ) {
7002
7006
  chunks.push(
7003
7007
  c('('),
7004
7008
  ...handle(node.body, state),
@@ -7961,7 +7965,7 @@
7961
7965
 
7962
7966
  const { enter, leave } = get_comment_handlers(comments, raw);
7963
7967
 
7964
- walk(node, {
7968
+ return walk(node, {
7965
7969
  enter,
7966
7970
 
7967
7971
  /** @param {any} node */
@@ -8063,7 +8067,6 @@
8063
8067
  node.update = node.update === EMPTY ? null : node.update;
8064
8068
  }
8065
8069
 
8066
- // @ts-ignore
8067
8070
  leave(node);
8068
8071
  }
8069
8072
  });
@@ -8082,11 +8085,11 @@
8082
8085
  const comments = [];
8083
8086
 
8084
8087
  try {
8085
- const ast = /** @type {any} */ (
8088
+ let ast = /** @type {any} */ (
8086
8089
  parse(str, acorn_opts(comments, str))
8087
8090
  );
8088
8091
 
8089
- inject(str, ast, values, comments);
8092
+ ast = inject(str, ast, values, comments);
8090
8093
 
8091
8094
  return ast.body;
8092
8095
  } catch (err) {
@@ -8107,7 +8110,7 @@
8107
8110
  const comments = [];
8108
8111
 
8109
8112
  try {
8110
- const expression =
8113
+ let expression =
8111
8114
  /** @type {Expression & { start: Number, end: number }} */ (
8112
8115
  parseExpressionAt(str, 0, acorn_opts(comments, str))
8113
8116
  );
@@ -8116,7 +8119,9 @@
8116
8119
  throw new Error(`Unexpected token '${match[0]}'`);
8117
8120
  }
8118
8121
 
8119
- inject(str, expression, values, comments);
8122
+ expression = /** @type {Expression & { start: Number, end: number }} */ (
8123
+ inject(str, expression, values, comments)
8124
+ );
8120
8125
 
8121
8126
  return expression;
8122
8127
  } catch (err) {
@@ -8137,11 +8142,11 @@
8137
8142
  const comments = [];
8138
8143
 
8139
8144
  try {
8140
- const expression = /** @type {any} */ (
8145
+ let expression = /** @type {any} */ (
8141
8146
  parseExpressionAt(str, 0, acorn_opts(comments, str))
8142
8147
  );
8143
8148
 
8144
- inject(str, expression, values, comments);
8149
+ expression = inject(str, expression, values, comments);
8145
8150
 
8146
8151
  return expression.properties[0];
8147
8152
  } catch (err) {
@@ -8210,6 +8215,8 @@
8210
8215
  });
8211
8216
 
8212
8217
  const whitespace = /[ \t\r\n]/;
8218
+ const start_whitespace = /^[ \t\r\n]*/;
8219
+ const end_whitespace = /[ \t\r\n]*$/;
8213
8220
  const dimensions = /^(?:offset|client)(?:Width|Height)$/;
8214
8221
 
8215
8222
  function list(items, conjunction = 'or') {
@@ -16396,6 +16403,7 @@
16396
16403
  'undefined',
16397
16404
  'URIError',
16398
16405
  'URL',
16406
+ 'URLSearchParams',
16399
16407
  'window'
16400
16408
  ]);
16401
16409
  const reserved = new Set([
@@ -17224,16 +17232,10 @@
17224
17232
  }
17225
17233
 
17226
17234
  function trim_start(str) {
17227
- let i = 0;
17228
- while (whitespace.test(str[i]))
17229
- i += 1;
17230
- return str.slice(i);
17235
+ return str.replace(start_whitespace, '');
17231
17236
  }
17232
17237
  function trim_end(str) {
17233
- let i = str.length;
17234
- while (whitespace.test(str[i - 1]))
17235
- i -= 1;
17236
- return str.slice(0, i);
17238
+ return str.replace(end_whitespace, '');
17237
17239
  }
17238
17240
 
17239
17241
  function to_string(node) {
@@ -19224,7 +19226,7 @@
19224
19226
 
19225
19227
  // The `foreign` namespace covers all DOM implementations that aren't HTML5.
19226
19228
  // It opts out of HTML5-specific a11y checks and case-insensitive attribute names.
19227
- const foreign = 'https://svelte.dev/docs#svelte_options';
19229
+ const foreign = 'https://svelte.dev/docs#template-syntax-svelte-options';
19228
19230
  const html = 'http://www.w3.org/1999/xhtml';
19229
19231
  const mathml = 'http://www.w3.org/1998/Math/MathML';
19230
19232
  const svg = 'http://www.w3.org/2000/svg';
@@ -19259,6 +19261,20 @@
19259
19261
  }
19260
19262
  }
19261
19263
 
19264
+ const non_textlike_input_types = new Set([
19265
+ 'button',
19266
+ 'checkbox',
19267
+ 'color',
19268
+ 'date',
19269
+ 'datetime-local',
19270
+ 'file',
19271
+ 'hidden',
19272
+ 'image',
19273
+ 'radio',
19274
+ 'range',
19275
+ 'reset',
19276
+ 'submit'
19277
+ ]);
19262
19278
  class BaseAttributeWrapper {
19263
19279
  constructor(parent, block, node) {
19264
19280
  this.node = node;
@@ -19405,7 +19421,7 @@
19405
19421
  }
19406
19422
  if (this.is_input_value) {
19407
19423
  const type = element.node.get_static_attribute_value('type');
19408
- if (type === null || type === '' || type === 'text' || type === 'email' || type === 'password') {
19424
+ if (type !== true && !non_textlike_input_types.has(type)) {
19409
19425
  condition = x `${condition} && ${element.var}.${property_name} !== ${should_cache ? last : value}`;
19410
19426
  }
19411
19427
  }
@@ -19842,6 +19858,28 @@
19842
19858
  });
19843
19859
  return dependencies;
19844
19860
  }
19861
+ get_update_dependencies() {
19862
+ const object = this.object;
19863
+ const dependencies = new Set();
19864
+ if (this.node.expression.template_scope.names.has(object)) {
19865
+ this.node.expression.template_scope.dependencies_for_name
19866
+ .get(object)
19867
+ .forEach((name) => dependencies.add(name));
19868
+ }
19869
+ else {
19870
+ dependencies.add(object);
19871
+ }
19872
+ const result = new Set(dependencies);
19873
+ dependencies.forEach((dependency) => {
19874
+ const indirect_dependencies = this.parent.renderer.component.indirect_dependencies.get(dependency);
19875
+ if (indirect_dependencies) {
19876
+ indirect_dependencies.forEach(indirect_dependency => {
19877
+ result.add(indirect_dependency);
19878
+ });
19879
+ }
19880
+ });
19881
+ return result;
19882
+ }
19845
19883
  is_readonly_media_attribute() {
19846
19884
  return this.node.is_readonly_media_attribute();
19847
19885
  }
@@ -20133,7 +20171,7 @@
20133
20171
  block.renderer.add_to_context(fn.name);
20134
20172
  const callee = block.renderer.reference(fn.name);
20135
20173
  const { contextual_dependencies, mutation } = binding.handler;
20136
- const dependencies = binding.get_dependencies();
20174
+ const dependencies = binding.get_update_dependencies();
20137
20175
  const body = b `
20138
20176
  ${mutation}
20139
20177
  ${Array.from(dependencies)
@@ -21445,7 +21483,7 @@
21445
21483
  const contextual_dependencies = new Set();
21446
21484
  binding_group.bindings.forEach(binding => {
21447
21485
  // TODO this is a mess
21448
- add_to_set(dependencies, binding.get_dependencies());
21486
+ add_to_set(dependencies, binding.get_update_dependencies());
21449
21487
  add_to_set(contextual_dependencies, binding.handler.contextual_dependencies);
21450
21488
  binding.render(block, lock);
21451
21489
  });
@@ -22050,12 +22088,13 @@
22050
22088
  if (this.needs_update) {
22051
22089
  block.chunks.init.push(b `
22052
22090
  function ${select_block_type}(#ctx, #dirty) {
22053
- ${this.branches.map(({ dependencies, condition, snippet, block }) => condition
22091
+ ${this.branches.map(({ dependencies, condition, snippet }) => {
22092
+ return b `${snippet && dependencies.length > 0 ? b `if (${block.renderer.dirty(dependencies)}) ${condition} = null;` : null}`;
22093
+ })}
22094
+ ${this.branches.map(({ condition, snippet, block }) => condition
22054
22095
  ? b `
22055
- ${snippet && (dependencies.length > 0
22056
- ? b `if (${condition} == null || ${block.renderer.dirty(dependencies)}) ${condition} = !!${snippet}`
22057
- : b `if (${condition} == null) ${condition} = !!${snippet}`)}
22058
- if (${condition}) return ${block.name};`
22096
+ ${snippet && b `if (${condition} == null) ${condition} = !!${snippet}`}
22097
+ if (${condition}) return ${block.name};`
22059
22098
  : b `return ${block.name};`)}
22060
22099
  }
22061
22100
  `);
@@ -22153,11 +22192,12 @@
22153
22192
  ${this.needs_update
22154
22193
  ? b `
22155
22194
  function ${select_block_type}(#ctx, #dirty) {
22156
- ${this.branches.map(({ dependencies, condition, snippet }, i) => condition
22195
+ ${this.branches.map(({ dependencies, condition, snippet }) => {
22196
+ return b `${snippet && dependencies.length > 0 ? b `if (${block.renderer.dirty(dependencies)}) ${condition} = null;` : null}`;
22197
+ })}
22198
+ ${this.branches.map(({ condition, snippet }, i) => condition
22157
22199
  ? b `
22158
- ${snippet && (dependencies.length > 0
22159
- ? b `if (${condition} == null || ${block.renderer.dirty(dependencies)}) ${condition} = !!${snippet}`
22160
- : b `if (${condition} == null) ${condition} = !!${snippet}`)}
22200
+ ${snippet && b `if (${condition} == null) ${condition} = !!${snippet}`}
22161
22201
  if (${condition}) return ${i};`
22162
22202
  : b `return ${i};`)}
22163
22203
  ${!has_else && b `return -1;`}
@@ -22631,6 +22671,10 @@
22631
22671
  code: 'a11y-unknown-role',
22632
22672
  message: `A11y: Unknown role '${role}'` + (suggestion ? ` (did you mean '${suggestion}'?)` : '')
22633
22673
  }),
22674
+ a11y_no_redundant_roles: (role) => ({
22675
+ code: 'a11y-no-redundant-roles',
22676
+ message: `A11y: Redundant role '${role}'`
22677
+ }),
22634
22678
  a11y_accesskey: {
22635
22679
  code: 'a11y-accesskey',
22636
22680
  message: 'A11y: Avoid using accesskey'
@@ -25964,7 +26008,7 @@
25964
26008
  }
25965
26009
  }
25966
26010
 
25967
- function unpack_destructuring(contexts, node, modifier = node => node, default_modifier = node => node) {
26011
+ function unpack_destructuring({ contexts, node, modifier = (node) => node, default_modifier = (node) => node, scope, component }) {
25968
26012
  if (!node)
25969
26013
  return;
25970
26014
  if (node.type === 'Identifier') {
@@ -25984,14 +26028,36 @@
25984
26028
  else if (node.type === 'ArrayPattern') {
25985
26029
  node.elements.forEach((element, i) => {
25986
26030
  if (element && element.type === 'RestElement') {
25987
- unpack_destructuring(contexts, element, node => x `${modifier(node)}.slice(${i})`, default_modifier);
26031
+ unpack_destructuring({
26032
+ contexts,
26033
+ node: element,
26034
+ modifier: (node) => x `${modifier(node)}.slice(${i})`,
26035
+ default_modifier,
26036
+ scope,
26037
+ component
26038
+ });
25988
26039
  }
25989
26040
  else if (element && element.type === 'AssignmentPattern') {
25990
26041
  const n = contexts.length;
25991
- unpack_destructuring(contexts, element.left, node => x `${modifier(node)}[${i}]`, (node, to_ctx) => x `${node} !== undefined ? ${node} : ${update_reference(contexts, n, element.right, to_ctx)}`);
26042
+ mark_referenced(element.right, scope, component);
26043
+ unpack_destructuring({
26044
+ contexts,
26045
+ node: element.left,
26046
+ modifier: (node) => x `${modifier(node)}[${i}]`,
26047
+ default_modifier: (node, to_ctx) => x `${node} !== undefined ? ${node} : ${update_reference(contexts, n, element.right, to_ctx)}`,
26048
+ scope,
26049
+ component
26050
+ });
25992
26051
  }
25993
26052
  else {
25994
- unpack_destructuring(contexts, element, node => x `${modifier(node)}[${i}]`, default_modifier);
26053
+ unpack_destructuring({
26054
+ contexts,
26055
+ node: element,
26056
+ modifier: (node) => x `${modifier(node)}[${i}]`,
26057
+ default_modifier,
26058
+ scope,
26059
+ component
26060
+ });
25995
26061
  }
25996
26062
  });
25997
26063
  }
@@ -25999,7 +26065,14 @@
25999
26065
  const used_properties = [];
26000
26066
  node.properties.forEach((property) => {
26001
26067
  if (property.type === 'RestElement') {
26002
- unpack_destructuring(contexts, property.argument, node => x `@object_without_properties(${modifier(node)}, [${used_properties}])`, default_modifier);
26068
+ unpack_destructuring({
26069
+ contexts,
26070
+ node: property.argument,
26071
+ modifier: (node) => x `@object_without_properties(${modifier(node)}, [${used_properties}])`,
26072
+ default_modifier,
26073
+ scope,
26074
+ component
26075
+ });
26003
26076
  }
26004
26077
  else {
26005
26078
  const key = property.key;
@@ -26007,10 +26080,25 @@
26007
26080
  used_properties.push(x `"${key.name}"`);
26008
26081
  if (value.type === 'AssignmentPattern') {
26009
26082
  const n = contexts.length;
26010
- unpack_destructuring(contexts, value.left, node => x `${modifier(node)}.${key.name}`, (node, to_ctx) => x `${node} !== undefined ? ${node} : ${update_reference(contexts, n, value.right, to_ctx)}`);
26083
+ mark_referenced(value.right, scope, component);
26084
+ unpack_destructuring({
26085
+ contexts,
26086
+ node: value.left,
26087
+ modifier: (node) => x `${modifier(node)}.${key.name}`,
26088
+ default_modifier: (node, to_ctx) => x `${node} !== undefined ? ${node} : ${update_reference(contexts, n, value.right, to_ctx)}`,
26089
+ scope,
26090
+ component
26091
+ });
26011
26092
  }
26012
26093
  else {
26013
- unpack_destructuring(contexts, value, node => x `${modifier(node)}.${key.name}`, default_modifier);
26094
+ unpack_destructuring({
26095
+ contexts,
26096
+ node: value,
26097
+ modifier: (node) => x `${modifier(node)}.${key.name}`,
26098
+ default_modifier,
26099
+ scope,
26100
+ component
26101
+ });
26014
26102
  }
26015
26103
  }
26016
26104
  });
@@ -26041,6 +26129,18 @@
26041
26129
  });
26042
26130
  return expression;
26043
26131
  }
26132
+ function mark_referenced(node, scope, component) {
26133
+ walk(node, {
26134
+ enter(node, parent) {
26135
+ if (is_reference(node, parent)) {
26136
+ const { name } = flatten_reference(node);
26137
+ if (!scope.is_let(name) && !scope.names.has(name)) {
26138
+ component.add_reference(name);
26139
+ }
26140
+ }
26141
+ }
26142
+ });
26143
+ }
26044
26144
 
26045
26145
  class AwaitBlock$1 extends Node$1 {
26046
26146
  constructor(component, parent, scope, info) {
@@ -26050,11 +26150,11 @@
26050
26150
  this.catch_node = info.error;
26051
26151
  if (this.then_node) {
26052
26152
  this.then_contexts = [];
26053
- unpack_destructuring(this.then_contexts, info.value);
26153
+ unpack_destructuring({ contexts: this.then_contexts, node: info.value, scope, component });
26054
26154
  }
26055
26155
  if (this.catch_node) {
26056
26156
  this.catch_contexts = [];
26057
- unpack_destructuring(this.catch_contexts, info.error);
26157
+ unpack_destructuring({ contexts: this.catch_contexts, node: info.error, scope, component });
26058
26158
  }
26059
26159
  this.pending = new PendingBlock(component, this, scope, info.pending);
26060
26160
  this.then = new ThenBlock(component, this, scope, info.then);
@@ -26150,7 +26250,7 @@
26150
26250
  this.index = info.index;
26151
26251
  this.scope = scope.child();
26152
26252
  this.contexts = [];
26153
- unpack_destructuring(this.contexts, info.context);
26253
+ unpack_destructuring({ contexts: this.contexts, node: info.context, scope, component });
26154
26254
  this.contexts.forEach(context => {
26155
26255
  this.scope.add(context.key.name, this.expression.dependencies, this);
26156
26256
  });
@@ -26485,6 +26585,44 @@
26485
26585
  'select',
26486
26586
  'textarea'
26487
26587
  ]);
26588
+ const a11y_nested_implicit_semantics = new Map([
26589
+ ['header', 'banner'],
26590
+ ['footer', 'contentinfo']
26591
+ ]);
26592
+ const a11y_implicit_semantics = new Map([
26593
+ ['a', 'link'],
26594
+ ['aside', 'complementary'],
26595
+ ['body', 'document'],
26596
+ ['datalist', 'listbox'],
26597
+ ['dd', 'definition'],
26598
+ ['dfn', 'term'],
26599
+ ['details', 'group'],
26600
+ ['dt', 'term'],
26601
+ ['fieldset', 'group'],
26602
+ ['form', 'form'],
26603
+ ['h1', 'heading'],
26604
+ ['h2', 'heading'],
26605
+ ['h3', 'heading'],
26606
+ ['h4', 'heading'],
26607
+ ['h5', 'heading'],
26608
+ ['h6', 'heading'],
26609
+ ['hr', 'separator'],
26610
+ ['li', 'listitem'],
26611
+ ['menu', 'list'],
26612
+ ['nav', 'navigation'],
26613
+ ['ol', 'list'],
26614
+ ['optgroup', 'group'],
26615
+ ['output', 'status'],
26616
+ ['progress', 'progressbar'],
26617
+ ['section', 'region'],
26618
+ ['summary', 'button'],
26619
+ ['tbody', 'rowgroup'],
26620
+ ['textarea', 'textbox'],
26621
+ ['tfoot', 'rowgroup'],
26622
+ ['thead', 'rowgroup'],
26623
+ ['tr', 'row'],
26624
+ ['ul', 'list']
26625
+ ]);
26488
26626
  const invisible_elements = new Set(['meta', 'html', 'script', 'style']);
26489
26627
  const valid_modifiers = new Set([
26490
26628
  'preventDefault',
@@ -26508,6 +26646,21 @@
26508
26646
  ['htmlFor', 'for']
26509
26647
  ]);
26510
26648
  const attributes_to_compact_whitespace = ['class', 'style'];
26649
+ function is_parent(parent, elements) {
26650
+ let check = false;
26651
+ while (parent) {
26652
+ const parent_name = parent.name;
26653
+ if (elements.includes(parent_name)) {
26654
+ check = true;
26655
+ break;
26656
+ }
26657
+ if (parent.type === 'Element') {
26658
+ break;
26659
+ }
26660
+ parent = parent.parent;
26661
+ }
26662
+ return check;
26663
+ }
26511
26664
  function get_namespace(parent, element, explicit_namespace) {
26512
26665
  const parent_element = parent.find_nearest(/^Element/);
26513
26666
  if (!parent_element) {
@@ -26713,6 +26866,19 @@
26713
26866
  const match = fuzzymatch(value, aria_roles);
26714
26867
  component.warn(attribute, compiler_warnings.a11y_unknown_role(value, match));
26715
26868
  }
26869
+ // no-redundant-roles
26870
+ const has_redundant_role = value === a11y_implicit_semantics.get(this.name);
26871
+ if (this.name === value || has_redundant_role) {
26872
+ component.warn(attribute, compiler_warnings.a11y_no_redundant_roles(value));
26873
+ }
26874
+ // Footers and headers are special cases, and should not have redundant roles unless they are the children of sections or articles.
26875
+ const is_parent_section_or_article = is_parent(this.parent, ['section', 'article']);
26876
+ if (!is_parent_section_or_article) {
26877
+ const has_nested_redundant_role = value === a11y_nested_implicit_semantics.get(this.name);
26878
+ if (has_nested_redundant_role) {
26879
+ component.warn(attribute, compiler_warnings.a11y_no_redundant_roles(value));
26880
+ }
26881
+ }
26716
26882
  }
26717
26883
  // no-access-key
26718
26884
  if (name === 'accesskey') {
@@ -30142,7 +30308,7 @@
30142
30308
  if (result) {
30143
30309
  const { compile_options, name } = this;
30144
30310
  const { format = 'esm' } = compile_options;
30145
- const banner = `${this.file ? `${this.file} ` : ''}generated by Svelte v${'3.44.0'}`;
30311
+ const banner = `${this.file ? `${this.file} ` : ''}generated by Svelte v${'3.45.0'}`;
30146
30312
  const program = { type: 'Program', body: result.js };
30147
30313
  walk(program, {
30148
30314
  enter: (node, parent, key) => {
@@ -30566,11 +30732,12 @@
30566
30732
  to_remove.unshift([parent, prop, index]);
30567
30733
  };
30568
30734
  let scope_updated = false;
30569
- let generator_count = 0;
30735
+ const current_function_stack = [];
30736
+ let current_function = null;
30570
30737
  walk(content, {
30571
30738
  enter(node, parent, prop, index) {
30572
- if ((node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression') && node.generator === true) {
30573
- generator_count++;
30739
+ if ((node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression')) {
30740
+ current_function_stack.push(current_function = node);
30574
30741
  }
30575
30742
  if (map.has(node)) {
30576
30743
  scope = map.get(node);
@@ -30595,11 +30762,12 @@
30595
30762
  component.warn_on_undefined_store_value_references(node, parent, prop, scope);
30596
30763
  },
30597
30764
  leave(node) {
30598
- if ((node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression') && node.generator === true) {
30599
- generator_count--;
30765
+ if ((node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression')) {
30766
+ current_function_stack.pop();
30767
+ current_function = current_function_stack[current_function_stack.length - 1];
30600
30768
  }
30601
30769
  // do it on leave, to prevent infinite loop
30602
- if (component.compile_options.dev && component.compile_options.loopGuardTimeout > 0 && generator_count <= 0) {
30770
+ if (component.compile_options.dev && component.compile_options.loopGuardTimeout > 0 && (!current_function || (!current_function.generator && !current_function.async))) {
30603
30771
  const to_replace_for_loop_protect = component.loop_protect(node, scope, component.compile_options.loopGuardTimeout);
30604
30772
  if (to_replace_for_loop_protect) {
30605
30773
  this.replace(to_replace_for_loop_protect);
@@ -31589,10 +31757,10 @@
31589
31757
  const { string, map } = await replace_in_code(tag_regex, process_single_tag, source);
31590
31758
  return { string, map, dependencies };
31591
31759
  }
31592
- async function process_markup(filename, process, source) {
31760
+ async function process_markup(process, source) {
31593
31761
  const processed = await process({
31594
31762
  content: source.source,
31595
- filename
31763
+ filename: source.filename
31596
31764
  });
31597
31765
  if (processed) {
31598
31766
  return {
@@ -31611,7 +31779,6 @@
31611
31779
  }
31612
31780
  }
31613
31781
  async function preprocess(source, preprocessor, options) {
31614
- // @ts-ignore todo: doublecheck
31615
31782
  const filename = (options && options.filename) || preprocessor.filename; // legacy
31616
31783
  const preprocessors = preprocessor ? (Array.isArray(preprocessor) ? preprocessor : [preprocessor]) : [];
31617
31784
  const markup = preprocessors.map(p => p.markup).filter(Boolean);
@@ -31621,7 +31788,7 @@
31621
31788
  // TODO keep track: what preprocessor generated what sourcemap?
31622
31789
  // to make debugging easier = detect low-resolution sourcemaps in fn combine_mappings
31623
31790
  for (const process of markup) {
31624
- result.update_source(await process_markup(filename, process, result));
31791
+ result.update_source(await process_markup(process, result));
31625
31792
  }
31626
31793
  for (const process of script) {
31627
31794
  result.update_source(await process_tag('script', process, result));
@@ -31632,7 +31799,7 @@
31632
31799
  return result.to_processed();
31633
31800
  }
31634
31801
 
31635
- const VERSION = '3.44.0';
31802
+ const VERSION = '3.45.0';
31636
31803
 
31637
31804
  exports.VERSION = VERSION;
31638
31805
  exports.compile = compile;