@vuebro/loader-sfc 2.0.3 → 2.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.
@@ -23299,12 +23299,16 @@ const Ng = async (e) => {
23299
23299
  Vs(n);
23300
23300
  const d = { expressionPlugins: ["jsx", "typescript"], scopeId: t, slotted: c }, g = l.some(({ scoped: x }) => x), f = g ? { __scopeId: t } : {};
23301
23301
  if (!(document.getElementById(t) instanceof HTMLStyleElement)) {
23302
- const x = document.createElement("style"), m = /* @__PURE__ */ new Set();
23303
- x.id = t, x.textContent = (await Promise.all(l.map(async ({ content: y, module: v, scoped: b = !1, src: E }) => {
23302
+ const x = /* @__PURE__ */ new Set(), m = (await Promise.all(l.map(async ({ content: y, module: v, scoped: b = !1, src: E }) => {
23304
23303
  const { code: w, errors: C } = await o_({ filename: e, id: t, scoped: b, source: E ? await (await Ng(E)).text() : y });
23305
- return v && m.add("<style module> is not supported in the playground."), Vs(C), w;
23304
+ return v && x.add("<style module> is not supported in the playground."), Vs(C), w;
23306
23305
  }))).join(`
23307
- `), document.head.appendChild(x), Vs([...m]);
23306
+ `).trim();
23307
+ if (m) {
23308
+ const y = document.createElement("style");
23309
+ y.id = t, y.textContent = m, document.head.appendChild(y);
23310
+ }
23311
+ Vs([...x]);
23308
23312
  }
23309
23313
  if (i || o) {
23310
23314
  const { bindings: x, content: m, warnings: y = [] } = K_(s, { id: t });
@@ -32,9 +32,8 @@ export default async (filename) => {
32
32
  slotted,
33
33
  }, scoped = styles.some(({ scoped }) => scoped), component = scoped ? { __scopeId: id } : {};
34
34
  if (!(document.getElementById(id) instanceof HTMLStyleElement)) {
35
- const el = document.createElement("style"), warnings = new Set();
36
- el.id = id;
37
- el.textContent = (await Promise.all(styles.map(async ({ content, module, scoped = false, src }) => {
35
+ const warnings = new Set();
36
+ const textContent = (await Promise.all(styles.map(async ({ content, module, scoped = false, src }) => {
38
37
  const { code, errors } = await compileStyleAsync({
39
38
  filename,
40
39
  id,
@@ -45,8 +44,15 @@ export default async (filename) => {
45
44
  warnings.add("<style module> is not supported in the playground.");
46
45
  log(errors);
47
46
  return code;
48
- }))).join("\n");
49
- document.head.appendChild(el);
47
+ })))
48
+ .join("\n")
49
+ .trim();
50
+ if (textContent) {
51
+ const el = document.createElement("style");
52
+ el.id = id;
53
+ el.textContent = textContent;
54
+ document.head.appendChild(el);
55
+ }
50
56
  log([...warnings]);
51
57
  }
52
58
  if (script || scriptSetup) {
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  "url": "git+https://github.com/vuebro/loader-sfc.git"
22
22
  },
23
23
  "license": "AGPL-3.0-only",
24
- "version": "2.0.3",
24
+ "version": "2.0.4",
25
25
  "type": "module",
26
26
  "main": "./dist/loader-sfc.js",
27
27
  "types": "./dist/loader-sfc.d.ts",