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.
- package/dist/vite-plugin.js +32 -22
- package/package.json +1 -1
- package/src/vite-plugin.ts +24 -0
package/dist/vite-plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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(
|
|
19
|
-
return
|
|
28
|
+
if (Object.values(t).includes(e))
|
|
29
|
+
return e;
|
|
20
30
|
},
|
|
21
|
-
load(
|
|
22
|
-
switch (
|
|
23
|
-
case
|
|
24
|
-
return `export const modules = import.meta.glob("${
|
|
25
|
-
case
|
|
26
|
-
return `export const modules = import.meta.glob("${
|
|
27
|
-
case
|
|
28
|
-
return `export const modules = import.meta.glob("${
|
|
29
|
-
case
|
|
30
|
-
return `export const modules = import.meta.glob("${
|
|
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(
|
|
36
|
-
if (Object.values(
|
|
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
|
-
|
|
52
|
+
l as vueWswgEditorPlugin
|
|
43
53
|
};
|
package/package.json
CHANGED
package/src/vite-plugin.ts
CHANGED
|
@@ -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:")) {
|