svelte 4.0.2 → 4.0.4

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/compiler.cjs CHANGED
@@ -43708,7 +43708,7 @@ function is_used_as_reference(node, parent) {
43708
43708
  * https://svelte.dev/docs/svelte-compiler#svelte-version
43709
43709
  * @type {string}
43710
43710
  */
43711
- const VERSION = '4.0.2';
43711
+ const VERSION = '4.0.4';
43712
43712
 
43713
43713
  const regex_leading_directory_separator = /^[/\\]/;
43714
43714
  const regex_starts_with_term_export = /^Export/;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "Cybernetically enhanced web apps",
5
5
  "type": "module",
6
6
  "module": "src/runtime/index.js",
@@ -777,14 +777,14 @@ export function claim_comment(nodes, data) {
777
777
  );
778
778
  }
779
779
 
780
- function find_comment(nodes, text, start) {
780
+ function get_comment_idx(nodes, text, start) {
781
781
  for (let i = start; i < nodes.length; i += 1) {
782
782
  const node = nodes[i];
783
783
  if (node.nodeType === 8 /* comment node */ && node.textContent.trim() === text) {
784
784
  return i;
785
785
  }
786
786
  }
787
- return nodes.length;
787
+ return -1;
788
788
  }
789
789
 
790
790
  /**
@@ -793,11 +793,12 @@ function find_comment(nodes, text, start) {
793
793
  */
794
794
  export function claim_html_tag(nodes, is_svg) {
795
795
  // find html opening tag
796
- const start_index = find_comment(nodes, 'HTML_TAG_START', 0);
797
- const end_index = find_comment(nodes, 'HTML_TAG_END', start_index);
798
- if (start_index === end_index) {
799
- return new HtmlTagHydration(undefined, is_svg);
796
+ const start_index = get_comment_idx(nodes, 'HTML_TAG_START', 0);
797
+ const end_index = get_comment_idx(nodes, 'HTML_TAG_END', start_index + 1);
798
+ if (start_index === -1 || end_index === -1) {
799
+ return new HtmlTagHydration(is_svg);
800
800
  }
801
+
801
802
  init_claim_info(nodes);
802
803
  const html_tag_nodes = nodes.splice(start_index, end_index - start_index + 1);
803
804
  detach(html_tag_nodes[0]);
@@ -807,7 +808,7 @@ export function claim_html_tag(nodes, is_svg) {
807
808
  n.claim_order = nodes.claim_info.total_claimed;
808
809
  nodes.claim_info.total_claimed += 1;
809
810
  }
810
- return new HtmlTagHydration(claimed_nodes, is_svg);
811
+ return new HtmlTagHydration(is_svg, claimed_nodes);
811
812
  }
812
813
 
813
814
  /**
@@ -1048,17 +1049,13 @@ export class HtmlTag {
1048
1049
  * @default false
1049
1050
  */
1050
1051
  is_svg = false;
1051
- // parent for creating node
1052
- /** */
1052
+ /** parent for creating node */
1053
1053
  e = undefined;
1054
- // html tag nodes
1055
- /** */
1054
+ /** html tag nodes */
1056
1055
  n = undefined;
1057
- // target
1058
- /** */
1056
+ /** target */
1059
1057
  t = undefined;
1060
- // anchor
1061
- /** */
1058
+ /** anchor */
1062
1059
  a = undefined;
1063
1060
  constructor(is_svg = false) {
1064
1061
  this.is_svg = is_svg;
@@ -1134,13 +1131,11 @@ export class HtmlTag {
1134
1131
  }
1135
1132
  }
1136
1133
 
1137
- /**
1138
- * @extends HtmlTag */
1139
1134
  export class HtmlTagHydration extends HtmlTag {
1140
- // hydration claimed nodes
1141
- /** */
1135
+ /** @type {Element[]} hydration claimed nodes */
1142
1136
  l = undefined;
1143
- constructor(claimed_nodes, is_svg = false) {
1137
+
1138
+ constructor(is_svg = false, claimed_nodes) {
1144
1139
  super(is_svg);
1145
1140
  this.e = this.n = null;
1146
1141
  this.l = claimed_nodes;
@@ -90,12 +90,12 @@ function split_srcset(srcset) {
90
90
 
91
91
  /**
92
92
  * @param {HTMLSourceElement | HTMLImageElement} element_srcset
93
- * @param {string} srcset
93
+ * @param {string | undefined | null} srcset
94
94
  * @returns {boolean}
95
95
  */
96
96
  export function srcset_url_equal(element_srcset, srcset) {
97
97
  const element_urls = split_srcset(element_srcset.srcset);
98
- const urls = split_srcset(srcset);
98
+ const urls = split_srcset(srcset || '');
99
99
 
100
100
  return (
101
101
  urls.length === element_urls.length &&
@@ -6,5 +6,5 @@
6
6
  * https://svelte.dev/docs/svelte-compiler#svelte-version
7
7
  * @type {string}
8
8
  */
9
- export const VERSION = '4.0.2';
9
+ export const VERSION = '4.0.4';
10
10
  export const PUBLIC_VERSION = '4';