@unhead/svelte 3.1.3 → 3.1.5

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/dist/bundler.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createFrameworkPlugin } from '@unhead/bundler/framework';
2
- import { u as unheadSvelteStreamingPlugin } from './shared/svelte.DyNDxHAA.mjs';
2
+ import { u as unheadSvelteStreamingPlugin } from './shared/svelte.CxnH_Noy.mjs';
3
3
  import 'magic-string';
4
4
  import 'oxc-walker';
5
5
  import 'unhead/stream/unplugin';
@@ -1 +1,2 @@
1
1
  export * from 'unhead/plugins';
2
+ import 'unhead/utils';
package/dist/plugins.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from 'unhead/plugins';
2
+ import 'unhead/utils';
@@ -6,8 +6,11 @@ import { createUnplugin } from 'unplugin';
6
6
  const SCRIPT_CLOSE_RE = /<\/script>/;
7
7
  const SCRIPT_RE = /<script[^>]*>/i;
8
8
  const FILTER_RE = /\.svelte$/;
9
+ function hasHeadComposable(code) {
10
+ return code.includes("useHead") || code.includes("useSeoMeta") || code.includes("useHeadSafe");
11
+ }
9
12
  function transform(code, id, isSSR, s) {
10
- if (!code.includes("useHead") && !code.includes("useSeoMeta") && !code.includes("useHeadSafe"))
13
+ if (!hasHeadComposable(code))
11
14
  return false;
12
15
  const scriptCloseMatch = code.match(SCRIPT_CLOSE_RE);
13
16
  if (!scriptCloseMatch)
@@ -56,6 +59,8 @@ const unheadSvelteStreamingPlugin = createUnplugin(
56
59
  filter: FILTER_RE,
57
60
  mode: options.mode,
58
61
  transform(code, id, opts) {
62
+ if (!hasHeadComposable(code))
63
+ return null;
59
64
  const s = new MagicString(code);
60
65
  if (!transform(code, id, opts?.ssr ?? false, s))
61
66
  return null;
@@ -1,4 +1,4 @@
1
- import { u as unheadSvelteStreamingPlugin } from '../shared/svelte.DyNDxHAA.mjs';
1
+ import { u as unheadSvelteStreamingPlugin } from '../shared/svelte.CxnH_Noy.mjs';
2
2
  import 'magic-string';
3
3
  import 'oxc-walker';
4
4
  import 'unhead/stream/unplugin';
package/dist/utils.d.mts CHANGED
@@ -1,2 +1 @@
1
1
  export * from 'unhead/utils';
2
- import 'unhead/plugins';
package/dist/utils.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  export * from 'unhead/utils';
2
- import 'unhead/plugins';
package/dist/vite.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Unhead as Unhead$1 } from './bundler.mjs';
2
2
  import '@unhead/bundler/framework';
3
- import './shared/svelte.DyNDxHAA.mjs';
3
+ import './shared/svelte.CxnH_Noy.mjs';
4
4
  import 'magic-string';
5
5
  import 'oxc-walker';
6
6
  import 'unhead/stream/unplugin';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/svelte",
3
3
  "type": "module",
4
- "version": "3.1.3",
4
+ "version": "3.1.5",
5
5
  "description": "Full-stack <head> manager built for Svelte.",
6
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
7
7
  "license": "MIT",
@@ -118,13 +118,13 @@
118
118
  "magic-string": "^0.30.21",
119
119
  "oxc-walker": "^1.0.0",
120
120
  "unplugin": "^3.0.0",
121
- "@unhead/bundler": "3.1.3",
122
- "unhead": "3.1.3"
121
+ "@unhead/bundler": "3.1.5",
122
+ "unhead": "3.1.5"
123
123
  },
124
124
  "devDependencies": {
125
125
  "@sveltejs/vite-plugin-svelte": "^7.1.2",
126
- "@testing-library/svelte": "^5.3.1",
127
- "svelte": "^5.56.1",
126
+ "@testing-library/svelte": "^5.4.2",
127
+ "svelte": "^5.56.3",
128
128
  "vite": "^8.0.16"
129
129
  },
130
130
  "scripts": {