vue-wswg-editor 0.0.8 → 0.0.9

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.
@@ -1,5 +1,5 @@
1
- function s(r) {
2
- const e = {
1
+ function l(u) {
2
+ const t = {
3
3
  blocks: "\0vue-wswg-editor:blocks",
4
4
  fields: "\0vue-wswg-editor:fields",
5
5
  layouts: "\0vue-wswg-editor:layouts",
@@ -9,35 +9,45 @@ function s(r) {
9
9
  name: "vue-wswg-editor-glob-plugin",
10
10
  enforce: "pre",
11
11
  // Run before other plugins to ensure import.meta.glob is processed correctly
12
- resolveId(t) {
13
- if (t.startsWith("vue-wswg-editor:")) {
14
- const u = t.replace("vue-wswg-editor:", "");
15
- if (u in e)
16
- return e[u];
12
+ config(e) {
13
+ const s = e.optimizeDeps || {}, r = s.exclude;
14
+ let o;
15
+ return Array.isArray(r) ? o = [...r] : typeof r == "string" ? o = [r] : o = [], o.includes("vue-wswg-editor") || o.push("vue-wswg-editor"), {
16
+ optimizeDeps: {
17
+ ...s,
18
+ exclude: o
19
+ }
20
+ };
21
+ },
22
+ resolveId(e) {
23
+ if (e.startsWith("vue-wswg-editor:")) {
24
+ const r = e.replace("vue-wswg-editor:", "");
25
+ if (r in t)
26
+ return t[r];
17
27
  }
18
- if (Object.values(e).includes(t))
19
- return t;
28
+ if (Object.values(t).includes(e))
29
+ return e;
20
30
  },
21
- load(t) {
22
- switch (t) {
23
- case e.layouts:
24
- return `export const modules = import.meta.glob("${r.rootDir}/layout/**/*.vue", { eager: true });`;
25
- case e.blocks:
26
- return `export const modules = import.meta.glob("${r.rootDir}/blocks/**/*.vue", { eager: true });`;
27
- case e.fields:
28
- return `export const modules = import.meta.glob("${r.rootDir}/blocks/**/fields.ts", { eager: true });`;
29
- case e.thumbnails:
30
- return `export const modules = import.meta.glob("${r.rootDir}/blocks/**/thumbnail.png", { eager: true });`;
31
+ load(e) {
32
+ switch (e) {
33
+ case t.layouts:
34
+ return `export const modules = import.meta.glob("${u.rootDir}/layout/**/*.vue", { eager: true });`;
35
+ case t.blocks:
36
+ return `export const modules = import.meta.glob("${u.rootDir}/blocks/**/*.vue", { eager: true });`;
37
+ case t.fields:
38
+ return `export const modules = import.meta.glob("${u.rootDir}/blocks/**/fields.ts", { eager: true });`;
39
+ case t.thumbnails:
40
+ return `export const modules = import.meta.glob("${u.rootDir}/blocks/**/thumbnail.png", { eager: true });`;
31
41
  default:
32
42
  return;
33
43
  }
34
44
  },
35
- transform(t, o) {
36
- if (Object.values(e).includes(o))
45
+ transform(e, s) {
46
+ if (Object.values(t).includes(s))
37
47
  return null;
38
48
  }
39
49
  };
40
50
  }
41
51
  export {
42
- s as vueWswgEditorPlugin
52
+ l as vueWswgEditorPlugin
43
53
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-wswg-editor",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "module": "src/index.ts",
@@ -21,6 +21,30 @@ export function vueWswgEditorPlugin(options: VueWswgEditorPluginOptions): Plugin
21
21
  name: "vue-wswg-editor-glob-plugin",
22
22
  enforce: "pre", // Run before other plugins to ensure import.meta.glob is processed correctly
23
23
 
24
+ config(config) {
25
+ // Exclude vue-wswg-editor from dependency optimization to prevent esbuild
26
+ // from trying to resolve virtual modules before plugins run
27
+ const optimizeDeps = config.optimizeDeps || {};
28
+ const existingExclude = optimizeDeps.exclude;
29
+ let exclude: string[];
30
+ if (Array.isArray(existingExclude)) {
31
+ exclude = [...existingExclude];
32
+ } else if (typeof existingExclude === "string") {
33
+ exclude = [existingExclude];
34
+ } else {
35
+ exclude = [];
36
+ }
37
+ if (!exclude.includes("vue-wswg-editor")) {
38
+ exclude.push("vue-wswg-editor");
39
+ }
40
+ return {
41
+ optimizeDeps: {
42
+ ...optimizeDeps,
43
+ exclude,
44
+ },
45
+ };
46
+ },
47
+
24
48
  resolveId(id) {
25
49
  // Handle virtual module imports like "vue-wswg-editor:layouts"
26
50
  if (id.startsWith("vue-wswg-editor:")) {