@shardev/vite-plugin-modular 1.1.1 → 1.2.1
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/README.md +80 -171
- package/dist/index.cjs +137 -220
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -9
- package/dist/index.d.ts +3 -9
- package/dist/index.js +137 -220
- package/dist/index.js.map +1 -1
- package/package.json +16 -11
package/dist/index.js
CHANGED
|
@@ -2,56 +2,65 @@
|
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import path from "path";
|
|
4
4
|
function laravelModule(options) {
|
|
5
|
+
const {
|
|
6
|
+
name,
|
|
7
|
+
vendor = "shardevcom",
|
|
8
|
+
srcDir = "resources/react/src",
|
|
9
|
+
input,
|
|
10
|
+
inputs,
|
|
11
|
+
buildDir = `build/${vendor}/${name}`,
|
|
12
|
+
publishedDir = `resources/react/${vendor}/${name}`
|
|
13
|
+
} = options;
|
|
14
|
+
const root = process.cwd();
|
|
15
|
+
const moduleRoot = path.resolve(root, "packages", vendor, name);
|
|
16
|
+
const relative = path.relative(moduleRoot, root);
|
|
17
|
+
const isModuleRoot = !relative || relative === "." || !relative.startsWith("..");
|
|
18
|
+
let normalizedInput = {};
|
|
19
|
+
if (input && Object.keys(input).length > 0) {
|
|
20
|
+
for (const [key, file] of Object.entries(input)) {
|
|
21
|
+
normalizedInput[key] = path.resolve(moduleRoot, file);
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
const legacyInputs = inputs ?? ["main.tsx"];
|
|
25
|
+
legacyInputs.forEach((file) => {
|
|
26
|
+
const key = path.parse(file).name;
|
|
27
|
+
normalizedInput[key] = path.resolve(moduleRoot, srcDir, file);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const publishedPath = path.resolve(root, publishedDir);
|
|
31
|
+
const isPublished = fs.existsSync(publishedPath);
|
|
32
|
+
const aliasPath = isPublished ? publishedPath : path.resolve(moduleRoot, srcDir);
|
|
33
|
+
const meta = {
|
|
34
|
+
name,
|
|
35
|
+
input: normalizedInput,
|
|
36
|
+
buildDir,
|
|
37
|
+
alias: {
|
|
38
|
+
[`@${vendor}/${name}`]: aliasPath
|
|
39
|
+
},
|
|
40
|
+
usePublished: isPublished
|
|
41
|
+
};
|
|
5
42
|
return {
|
|
6
|
-
name: `vite-plugin-laravel-module:${
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
vendor = "shardevcom",
|
|
11
|
-
srcDir = "resources/react/src",
|
|
12
|
-
inputs = ["main.tsx"],
|
|
13
|
-
buildDir = `build/${vendor}/${name}`,
|
|
14
|
-
publishedDir = `resources/react/${name}`
|
|
15
|
-
} = options;
|
|
16
|
-
const moduleRoot = path.resolve(`packages/${vendor}/${name}`);
|
|
17
|
-
const isModuleRoot = process.cwd() === moduleRoot;
|
|
18
|
-
const inputPaths = {};
|
|
19
|
-
inputs.forEach((file) => {
|
|
20
|
-
const key = path.parse(file).name;
|
|
21
|
-
inputPaths[key] = path.resolve(moduleRoot, srcDir, file);
|
|
22
|
-
});
|
|
23
|
-
const publishedPath = path.resolve(publishedDir);
|
|
24
|
-
const isPublished = fs.existsSync(publishedPath);
|
|
43
|
+
name: `vite-plugin-laravel-module:${name}`,
|
|
44
|
+
// 🔥 Metadata consumida por laravelModules()
|
|
45
|
+
shardevMeta: meta,
|
|
46
|
+
config() {
|
|
25
47
|
if (isModuleRoot) {
|
|
26
48
|
return {
|
|
27
49
|
build: {
|
|
28
50
|
outDir: buildDir,
|
|
29
51
|
emptyOutDir: true,
|
|
30
52
|
rollupOptions: {
|
|
31
|
-
input:
|
|
53
|
+
input: normalizedInput
|
|
32
54
|
}
|
|
33
55
|
},
|
|
34
56
|
resolve: {
|
|
35
|
-
alias:
|
|
36
|
-
[`@${vendor}/${name}`]: path.resolve(srcDir)
|
|
37
|
-
}
|
|
57
|
+
alias: meta.alias
|
|
38
58
|
}
|
|
39
59
|
};
|
|
40
60
|
}
|
|
41
61
|
return {
|
|
42
|
-
shardevModule: JSON.stringify({
|
|
43
|
-
...options,
|
|
44
|
-
srcDir,
|
|
45
|
-
input: isPublished ? void 0 : inputPaths,
|
|
46
|
-
usePublished: isPublished,
|
|
47
|
-
alias: {
|
|
48
|
-
[`@${vendor}/${name}`]: isPublished ? publishedPath : path.resolve(moduleRoot, srcDir)
|
|
49
|
-
}
|
|
50
|
-
}),
|
|
51
62
|
resolve: {
|
|
52
|
-
alias:
|
|
53
|
-
[`@${vendor}/${name}`]: isPublished ? publishedPath : path.resolve(moduleRoot, srcDir)
|
|
54
|
-
}
|
|
63
|
+
alias: meta.alias
|
|
55
64
|
}
|
|
56
65
|
};
|
|
57
66
|
}
|
|
@@ -63,224 +72,132 @@ import { mergeConfig, createServer } from "vite";
|
|
|
63
72
|
import path2 from "path";
|
|
64
73
|
import fs2 from "fs";
|
|
65
74
|
function laravelModules(options = {}) {
|
|
66
|
-
const {
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
const {
|
|
76
|
+
modulesDir = "packages",
|
|
77
|
+
statusesFile = "modules.json",
|
|
78
|
+
debug = false,
|
|
79
|
+
useMetaCache = true
|
|
80
|
+
} = options;
|
|
69
81
|
const root = process.cwd();
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return plugin && typeof plugin === "object" && "name" in plugin ? [plugin] : [];
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
const flatPlugins = flattenPlugins(plugins);
|
|
80
|
-
return flatPlugins.find((plugin) => plugin?.name === "laravel") ?? null;
|
|
81
|
-
};
|
|
82
|
-
const normalizePath = (id) => {
|
|
83
|
-
let cleanPath = id.replace(/^[\/\\]+/, "").split("?")[0].split("#")[0];
|
|
84
|
-
cleanPath = cleanPath.replace(/\\/g, "/");
|
|
85
|
-
const normalizedRoot = root.replace(/\\/g, "/");
|
|
86
|
-
if (cleanPath.startsWith(normalizedRoot)) {
|
|
87
|
-
cleanPath = cleanPath.slice(normalizedRoot.length).replace(/^\/+/, "");
|
|
88
|
-
}
|
|
89
|
-
return cleanPath;
|
|
90
|
-
};
|
|
91
|
-
const parseNamespace = (id) => {
|
|
92
|
-
const cleanPath = normalizePath(id);
|
|
93
|
-
const patterns = [
|
|
94
|
-
/^([\w.-]+):([\w.-]+)::(.+)$/,
|
|
95
|
-
// vendor:pkg::file
|
|
96
|
-
/^packages\/([^/]+)\/([^/]+)\/resources\/react\/src\/(.+)$/,
|
|
97
|
-
// packages/vendor/pkg/resources/react/src/file
|
|
98
|
-
/^resources\/react\/([^/]+)\/([^/]+)\/src\/(.+)$/
|
|
99
|
-
// resources/react/vendor/pkg/src/file
|
|
100
|
-
];
|
|
101
|
-
for (const pattern of patterns) {
|
|
102
|
-
const match = cleanPath.match(pattern);
|
|
103
|
-
if (match) {
|
|
104
|
-
return { vendor: match[1], pkg: match[2], file: match[3] };
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return null;
|
|
82
|
+
const modulesPath = path2.resolve(root, modulesDir);
|
|
83
|
+
const statusesPath = path2.resolve(root, statusesFile);
|
|
84
|
+
let cachedMetas = [];
|
|
85
|
+
let metaCacheLoaded = false;
|
|
86
|
+
const log = (...args) => {
|
|
87
|
+
if (debug) console.log("[laravel-modules]", ...args);
|
|
108
88
|
};
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
path2.join(root, "resources", "react", vendor, pkg, "src", file),
|
|
112
|
-
// Published path
|
|
113
|
-
path2.join(root, "packages", vendor, pkg, "resources", "react", "src", file)
|
|
114
|
-
// Workspace path
|
|
115
|
-
];
|
|
116
|
-
return paths.find(fs2.existsSync) || null;
|
|
117
|
-
};
|
|
118
|
-
const loadModuleStatuses = () => {
|
|
89
|
+
const loadStatuses = () => {
|
|
90
|
+
if (!fs2.existsSync(statusesPath)) return {};
|
|
119
91
|
try {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
} catch (error) {
|
|
124
|
-
console.warn("[laravel-modules] Failed to load module statuses:", error);
|
|
92
|
+
return JSON.parse(fs2.readFileSync(statusesPath, "utf-8"));
|
|
93
|
+
} catch {
|
|
94
|
+
return {};
|
|
125
95
|
}
|
|
126
|
-
return {};
|
|
127
96
|
};
|
|
128
|
-
const
|
|
129
|
-
|
|
97
|
+
const validateMeta = (meta) => {
|
|
98
|
+
if (!meta.name) throw new Error("Module meta missing name");
|
|
99
|
+
if (!meta.srcDir) throw new Error(`Module ${meta.name} missing srcDir`);
|
|
100
|
+
if (!meta.input) throw new Error(`Module ${meta.name} missing input`);
|
|
130
101
|
};
|
|
131
|
-
const discoverModules = async (
|
|
102
|
+
const discoverModules = async () => {
|
|
103
|
+
if (useMetaCache && metaCacheLoaded) {
|
|
104
|
+
log("Using cached module metas");
|
|
105
|
+
return cachedMetas;
|
|
106
|
+
}
|
|
132
107
|
if (!fs2.existsSync(modulesPath)) return [];
|
|
133
|
-
const
|
|
134
|
-
const
|
|
108
|
+
const statuses = loadStatuses();
|
|
109
|
+
const metas = [];
|
|
110
|
+
const vendors = fs2.readdirSync(modulesPath, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
135
111
|
for (const vendor of vendors) {
|
|
136
112
|
const vendorPath = path2.join(modulesPath, vendor.name);
|
|
137
|
-
const packages = fs2.readdirSync(vendorPath, { withFileTypes: true }).filter((
|
|
113
|
+
const packages = fs2.readdirSync(vendorPath, { withFileTypes: true }).filter((d) => d.isDirectory() && statuses[d.name] !== false);
|
|
138
114
|
for (const pkg of packages) {
|
|
139
115
|
const pkgPath = path2.join(vendorPath, pkg.name);
|
|
140
116
|
const viteConfigPath = path2.join(pkgPath, "vite.config.ts");
|
|
141
117
|
if (!fs2.existsSync(viteConfigPath)) continue;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
118
|
+
const server = await createServer({
|
|
119
|
+
configFile: viteConfigPath,
|
|
120
|
+
logLevel: "silent"
|
|
121
|
+
});
|
|
122
|
+
const plugins = server.config.plugins || [];
|
|
123
|
+
for (const plugin of plugins) {
|
|
124
|
+
if (plugin?.name?.startsWith("vite-plugin-laravel-module:")) {
|
|
125
|
+
const meta = plugin.shardevMeta;
|
|
126
|
+
if (meta) {
|
|
127
|
+
validateMeta(meta);
|
|
128
|
+
metas.push(meta);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
151
131
|
}
|
|
132
|
+
await server.close();
|
|
152
133
|
}
|
|
153
134
|
}
|
|
154
|
-
|
|
135
|
+
cachedMetas = metas;
|
|
136
|
+
metaCacheLoaded = true;
|
|
137
|
+
log("Discovered modules:", metas.map((m) => m.name));
|
|
138
|
+
return metas;
|
|
155
139
|
};
|
|
156
|
-
const
|
|
157
|
-
const aliases = {};
|
|
158
|
-
const moduleConfigs = [];
|
|
159
|
-
plugins.forEach((plugin) => {
|
|
160
|
-
if (!plugin?.name?.startsWith("vite-plugin-laravel-module:")) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
let resolvedConfig;
|
|
164
|
-
if (typeof plugin.config === "function") {
|
|
165
|
-
const fn = plugin.config;
|
|
166
|
-
resolvedConfig = fn({});
|
|
167
|
-
}
|
|
168
|
-
if (!resolvedConfig?.shardevModule) return;
|
|
169
|
-
try {
|
|
170
|
-
const meta = JSON.parse(resolvedConfig?.shardevModule);
|
|
171
|
-
if (meta.alias) Object.assign(aliases, meta.alias);
|
|
172
|
-
if (!meta.usePublished && meta.input) moduleConfigs.push(meta);
|
|
173
|
-
} catch (error) {
|
|
174
|
-
console.warn("[laravel-modules] Failed to parse module metadata:", error);
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
return { aliases, moduleConfigs };
|
|
178
|
-
};
|
|
179
|
-
const generateRollupInputs = (moduleConfigs) => {
|
|
140
|
+
const generateInputs = (metas) => {
|
|
180
141
|
const inputs = {};
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const name = modInputs.length > 1 ? `${mod.name}-${idx}` : mod.name;
|
|
185
|
-
inputs[name] = inputPath;
|
|
142
|
+
metas.forEach((meta) => {
|
|
143
|
+
Object.entries(meta.input).forEach(([key, value]) => {
|
|
144
|
+
inputs[`${meta.name}-${key}`] = value;
|
|
186
145
|
});
|
|
187
146
|
});
|
|
188
147
|
return inputs;
|
|
189
148
|
};
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
if (typeof alias === "object") {
|
|
213
|
-
return { ...alias };
|
|
214
|
-
}
|
|
215
|
-
return {};
|
|
216
|
-
}
|
|
149
|
+
const resolveWatchPath = (meta) => {
|
|
150
|
+
const base = meta.usePublished && meta.publishedDir ? meta.publishedDir : meta.srcDir;
|
|
151
|
+
if (!base) return null;
|
|
152
|
+
return path2.isAbsolute(base) ? base : path2.resolve(root, base);
|
|
153
|
+
};
|
|
154
|
+
const handleHMR = (server, file) => {
|
|
155
|
+
const module = server.moduleGraph.getModuleById(file);
|
|
156
|
+
if (!module) return;
|
|
157
|
+
log("HMR update:", file);
|
|
158
|
+
const updates = [{
|
|
159
|
+
type: "js-update",
|
|
160
|
+
path: module.url,
|
|
161
|
+
acceptedPath: module.url,
|
|
162
|
+
timestamp: Date.now()
|
|
163
|
+
}];
|
|
164
|
+
server.moduleGraph.invalidateModule(module);
|
|
165
|
+
server.ws.send({
|
|
166
|
+
type: "update",
|
|
167
|
+
updates
|
|
168
|
+
});
|
|
169
|
+
};
|
|
217
170
|
return {
|
|
218
171
|
name: "laravel-modules",
|
|
219
172
|
async config(config, env) {
|
|
220
|
-
const
|
|
221
|
-
const modules = await discoverModules(statuses);
|
|
173
|
+
const metas = await discoverModules();
|
|
222
174
|
const aliases = {};
|
|
223
|
-
|
|
224
|
-
const
|
|
225
|
-
if (laravelPlugin && laravelPlugin?.config) {
|
|
226
|
-
try {
|
|
227
|
-
const laravelConfig = getLaravelResolvedConfig(laravelPlugin, config, env);
|
|
228
|
-
if (!laravelConfig) throw new Error("Invalid Laravel config");
|
|
229
|
-
moduleConfigs.push({
|
|
230
|
-
name: "main",
|
|
231
|
-
input: getInputArray(laravelConfig?.build?.rollupOptions?.input || []),
|
|
232
|
-
buildDir: laravelConfig?.build?.buildDir || "build",
|
|
233
|
-
alias: extractAliases(laravelConfig)
|
|
234
|
-
});
|
|
235
|
-
} catch (error) {
|
|
236
|
-
console.warn("[laravel-modules] Failed to extract Laravel plugin config:", error);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
const { aliases: moduleAliases, moduleConfigs: extractedConfigs } = extractModuleMetadata(modules);
|
|
240
|
-
Object.assign(aliases, moduleAliases);
|
|
241
|
-
moduleConfigs.push(...extractedConfigs);
|
|
242
|
-
const rollupInputs = generateRollupInputs(moduleConfigs);
|
|
175
|
+
metas.forEach((meta) => Object.assign(aliases, meta.alias));
|
|
176
|
+
const rollupInputs = generateInputs(metas);
|
|
243
177
|
return mergeConfig(config, {
|
|
244
|
-
resolve: {
|
|
245
|
-
alias: aliases
|
|
246
|
-
},
|
|
178
|
+
resolve: { alias: aliases },
|
|
247
179
|
build: {
|
|
248
|
-
rollupOptions: {
|
|
249
|
-
input: rollupInputs
|
|
250
|
-
}
|
|
180
|
+
rollupOptions: { input: rollupInputs }
|
|
251
181
|
}
|
|
252
182
|
});
|
|
253
183
|
},
|
|
254
|
-
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
writeBundle(_, bundle) {
|
|
262
|
-
const manifestFile = Object.keys(bundle).find((f) => f === "manifest.json");
|
|
263
|
-
if (!manifestFile) return;
|
|
264
|
-
const asset = bundle[manifestFile];
|
|
265
|
-
if (asset?.type !== "asset" || typeof asset.source !== "string") return;
|
|
266
|
-
try {
|
|
267
|
-
const manifest = JSON.parse(asset.source);
|
|
268
|
-
const rewritten = { ...manifest };
|
|
269
|
-
for (const [src, data] of Object.entries(manifest)) {
|
|
270
|
-
const ns = parseNamespace(src);
|
|
271
|
-
if (ns) {
|
|
272
|
-
const aliasKey = `${ns.vendor}:${ns.pkg}::${ns.file}`;
|
|
273
|
-
rewritten[aliasKey] = data;
|
|
274
|
-
}
|
|
184
|
+
async configureServer(server) {
|
|
185
|
+
const metas = await discoverModules();
|
|
186
|
+
for (const meta of metas) {
|
|
187
|
+
const watchPath = resolveWatchPath(meta);
|
|
188
|
+
if (watchPath && fs2.existsSync(watchPath)) {
|
|
189
|
+
server.watcher.add(watchPath);
|
|
190
|
+
log("Watching:", watchPath);
|
|
275
191
|
}
|
|
276
|
-
asset.source = JSON.stringify(rewritten, null, 2);
|
|
277
|
-
const outDir = _.dir || path2.dirname(_.file || "");
|
|
278
|
-
const outPath = path2.join(outDir, manifestFile);
|
|
279
|
-
fs2.writeFileSync(outPath, asset.source, "utf-8");
|
|
280
|
-
console.log("[laravel-modules] Manifest namespaced keys injected");
|
|
281
|
-
} catch (error) {
|
|
282
|
-
console.warn("[laravel-modules] Failed to process manifest:", error);
|
|
283
192
|
}
|
|
193
|
+
server.watcher.on("change", (file) => {
|
|
194
|
+
const matched = metas.some((meta) => {
|
|
195
|
+
const watchPath = resolveWatchPath(meta);
|
|
196
|
+
return watchPath && file.startsWith(watchPath);
|
|
197
|
+
});
|
|
198
|
+
if (!matched) return;
|
|
199
|
+
handleHMR(server, file);
|
|
200
|
+
});
|
|
284
201
|
}
|
|
285
202
|
};
|
|
286
203
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/laravelModule.ts","../src/laravelModules.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport type { PluginOption } from 'vite';\n\ninterface ModuleOptions {\n name: string;\n vendor?: string;\n srcDir?: string;\n inputs?: string[];\n buildDir?: string;\n publishedDir?: string;\n}\n\nexport default function laravelModule(options: ModuleOptions): PluginOption {\n return {\n name: `vite-plugin-laravel-module:${options.name}`,\n config: () => {\n const {\n name,\n vendor = 'shardevcom',\n srcDir = 'resources/react/src',\n inputs = ['main.tsx'],\n buildDir = `build/${vendor}/${name}`,\n publishedDir = `resources/react/${name}`\n } = options;\n\n const moduleRoot = path.resolve(`packages/${vendor}/${name}`);\n const isModuleRoot = process.cwd() === moduleRoot;\n\n const inputPaths: Record<string, string> = {};\n inputs.forEach((file) => {\n const key = path.parse(file).name;\n inputPaths[key] = path.resolve(moduleRoot, srcDir, file);\n });\n\n const publishedPath = path.resolve(publishedDir);\n const isPublished = fs.existsSync(publishedPath);\n\n if (isModuleRoot) {\n return {\n build: {\n outDir: buildDir,\n emptyOutDir: true,\n rollupOptions: {\n input: inputPaths\n }\n },\n resolve: {\n alias: {\n [`@${vendor}/${name}`]: path.resolve(srcDir)\n }\n }\n };\n }\n\n return {\n shardevModule: JSON.stringify({\n ...options,\n srcDir,\n input: isPublished ? undefined : inputPaths,\n usePublished: isPublished,\n alias: {\n [`@${vendor}/${name}`]: isPublished ? publishedPath : path.resolve(moduleRoot, srcDir)\n }\n }),\n resolve: {\n alias: {\n [`@${vendor}/${name}`]: isPublished ? publishedPath : path.resolve(moduleRoot, srcDir)\n }\n }\n };\n }\n };\n}\n","import type { Plugin, UserConfig, PluginOption, ConfigEnv } from 'vite';\nimport { mergeConfig, createServer } from 'vite';\nimport path from 'path';\nimport fs from 'fs';\n\ninterface LaravelModulesOptions {\n modulesDir?: string;\n statusesFile?: string;\n}\n\ninterface ModuleConfigMeta {\n name: string;\n input: string[];\n buildDir: string;\n alias?: Record<string, string>;\n usePublished?: boolean;\n}\n\ninterface ParsedNamespace {\n vendor: string;\n pkg: string;\n file: string;\n}\n\nexport interface ShardevUserConfig extends UserConfig {\n shardevModule?: string; // JSON.stringify(ModuleConfigMeta)\n}\n\ninterface LaravelResolvedConfig {\n build?: {\n rollupOptions?: {\n input?: string[] | Record<string, string>;\n };\n buildDir?: string;\n };\n resolve?: {\n alias?: Record<string, string> | Array<{ find: string | RegExp, replacement: string }>;\n };\n}\n\ninterface ModuleDiscoveryResult {\n aliases: Record<string, string>;\n moduleConfigs: ModuleConfigMeta[];\n}\n\n/**\n * Laravel Modules Plugin for Vite\n *\n * This plugin enables Vite to work with Laravel modules by:\n * 1. Discovering and loading module configurations\n * 2. Resolving module-specific aliases\n * 3. Handling namespace resolution for modules\n * 4. Processing manifest files for proper asset handling\n */\nexport default function laravelModules(options: LaravelModulesOptions = {}): Plugin {\n const { modulesDir = 'packages', statusesFile = 'modules.json' } = options;\n const modulesPath = path.resolve(process.cwd(), modulesDir);\n const statusesPath = path.resolve(process.cwd(), statusesFile);\n const root = process.cwd();\n\n /**\n * Finds the Laravel plugin instance within the main Vite config\n */\n const findLaravelPlugin = (plugins: PluginOption[]): Plugin | null => {\n const flattenPlugins = (plugins: PluginOption[]): Plugin[] => {\n return plugins.flatMap(plugin => {\n if (Array.isArray(plugin)) {\n return flattenPlugins(plugin);\n }\n return plugin && typeof plugin === 'object' && 'name' in plugin ? [plugin] : [];\n });\n };\n\n const flatPlugins = flattenPlugins(plugins);\n return flatPlugins.find(plugin => plugin?.name === 'laravel') ?? null;\n };\n\n /**\n * Normalizes path by removing query/hash and standardizing separators\n */\n const normalizePath = (id: string): string => {\n // Remove query/hash and leading slashes\n let cleanPath = id.replace(/^[\\/\\\\]+/, '').split('?')[0].split('#')[0];\n\n // Normalize separators to forward slashes\n cleanPath = cleanPath.replace(/\\\\/g, '/');\n\n // Remove root prefix if present\n const normalizedRoot = root.replace(/\\\\/g, '/');\n if (cleanPath.startsWith(normalizedRoot)) {\n cleanPath = cleanPath.slice(normalizedRoot.length).replace(/^\\/+/, '');\n }\n\n return cleanPath;\n };\n\n /**\n * Parses namespace from path using multiple patterns\n */\n const parseNamespace = (id: string): ParsedNamespace | null => {\n const cleanPath = normalizePath(id);\n\n const patterns = [\n /^([\\w.-]+):([\\w.-]+)::(.+)$/, // vendor:pkg::file\n /^packages\\/([^/]+)\\/([^/]+)\\/resources\\/react\\/src\\/(.+)$/, // packages/vendor/pkg/resources/react/src/file\n /^resources\\/react\\/([^/]+)\\/([^/]+)\\/src\\/(.+)$/ // resources/react/vendor/pkg/src/file\n ];\n\n for (const pattern of patterns) {\n const match = cleanPath.match(pattern);\n if (match) {\n return { vendor: match[1], pkg: match[2], file: match[3] };\n }\n }\n\n return null;\n };\n\n /**\n * Resolves namespace to filesystem path\n */\n const resolveNamespacedToFs = (vendor: string, pkg: string, file: string): string | null => {\n const paths = [\n path.join(root, 'resources', 'react', vendor, pkg, 'src', file), // Published path\n path.join(root, 'packages', vendor, pkg, 'resources', 'react', 'src', file) // Workspace path\n ];\n\n return paths.find(fs.existsSync) || null;\n };\n\n /**\n * Loads module activation statuses from JSON file\n */\n const loadModuleStatuses = (): Record<string, boolean> => {\n try {\n if (fs.existsSync(statusesPath)) {\n return JSON.parse(fs.readFileSync(statusesPath, 'utf-8'));\n }\n } catch (error) {\n console.warn('[laravel-modules] Failed to load module statuses:', error);\n }\n\n return {};\n };\n\n /**\n * Extracts input array from various input formats\n */\n const getInputArray = (input: string[] | Record<string, string>): string[] => {\n return Array.isArray(input) ? input : Object.values(input || {});\n };\n\n /**\n * Discovers all active modules with a vite.config.* file\n */\n const discoverModules = async (statuses: Record<string, boolean>): Promise<Plugin[]> => {\n if (!fs.existsSync(modulesPath)) return [];\n\n const plugins: Plugin[] = [];\n const vendors = fs.readdirSync(modulesPath, { withFileTypes: true })\n .filter(dirent => dirent.isDirectory());\n\n for (const vendor of vendors) {\n const vendorPath = path.join(modulesPath, vendor.name);\n const packages = fs.readdirSync(vendorPath, { withFileTypes: true })\n .filter(dirent => dirent.isDirectory() && (statuses[dirent.name] !== false));\n\n for (const pkg of packages) {\n const pkgPath = path.join(vendorPath, pkg.name);\n const viteConfigPath = path.join(pkgPath, 'vite.config.ts');\n\n if (!fs.existsSync(viteConfigPath)) continue;\n\n try {\n const server = await createServer({\n configFile: viteConfigPath,\n logLevel: 'silent'\n });\n\n // 🚨 Aquí capturamos los plugins del módulo\n plugins.push(...(server.config.plugins as Plugin[]));\n await server.close();\n } catch (error) {\n console.warn(`[laravel-modules] Error loading ${viteConfigPath}:`, error);\n }\n }\n }\n\n return plugins;\n };\n\n\n /**\n * Extracts module metadata from plugins\n */\n const extractModuleMetadata = (plugins: Plugin[]): ModuleDiscoveryResult => {\n const aliases: Record<string, string> = {};\n const moduleConfigs: ModuleConfigMeta[] = [];\n\n plugins.forEach(plugin => {\n\n if (!plugin?.name?.startsWith(\"vite-plugin-laravel-module:\")) {\n return;\n }\n\n let resolvedConfig: ShardevUserConfig | undefined;\n if (typeof plugin.config === \"function\") {\n const fn = plugin.config as (config: ShardevUserConfig, env?: ConfigEnv) => ShardevUserConfig;\n resolvedConfig = fn({}) as ShardevUserConfig;\n }\n\n if (!resolvedConfig?.shardevModule) return;\n\n try {\n const meta: ModuleConfigMeta = JSON.parse(resolvedConfig?.shardevModule);\n if (meta.alias) Object.assign(aliases, meta.alias);\n if (!meta.usePublished && meta.input) moduleConfigs.push(meta);\n } catch (error) {\n console.warn('[laravel-modules] Failed to parse module metadata:', error);\n }\n });\n\n return { aliases, moduleConfigs };\n };\n\n /**\n * Generates rollup inputs from module configurations\n */\n const generateRollupInputs = (moduleConfigs: ModuleConfigMeta[]): Record<string, string> => {\n const inputs: Record<string, string> = {};\n\n moduleConfigs.forEach(mod => {\n const modInputs = getInputArray(mod.input);\n modInputs.forEach((inputPath, idx) => {\n const name = modInputs.length > 1 ? `${mod.name}-${idx}` : mod.name;\n inputs[name] = inputPath;\n });\n });\n\n return inputs;\n };\n\n /**\n * Retrieves resolved Laravel configuration from the plugin\n */\n function getLaravelResolvedConfig(plugin: Plugin, config: UserConfig, env: ConfigEnv) {\n if (!plugin.config || typeof plugin.config !== 'function') return null;\n\n try {\n const fn = plugin.config as (config: UserConfig, env?: ConfigEnv) => LaravelResolvedConfig;\n const result = fn(config, env) as LaravelResolvedConfig;\n return result && typeof result === 'object' ? result : null;\n } catch (error) {\n console.warn('[laravel-modules] Failed to get Laravel config:', error);\n return null;\n }\n }\n\n /**\n * Extracts aliases from Laravel config\n */\n function extractAliases(config: LaravelResolvedConfig): Record<string, string> {\n const alias = config?.resolve?.alias;\n\n if (!alias) return {};\n\n if (Array.isArray(alias)) {\n // Convertir array format [{ find: 'foo', replacement: 'bar' }] to object { foo: 'bar' }\n return alias.reduce((acc, item) => {\n if (item && typeof item.find === 'string' && typeof item.replacement === 'string') {\n acc[item.find] = item.replacement;\n }\n return acc;\n }, {} as Record<string, string>);\n }\n\n if (typeof alias === 'object') {\n return { ...alias };\n }\n\n return {};\n }\n\n\n return {\n name: 'laravel-modules',\n\n async config(config: UserConfig, env) {\n const statuses = loadModuleStatuses();\n const modules = await discoverModules(statuses);\n\n const aliases: Record<string, string> = {};\n const moduleConfigs: ModuleConfigMeta[] = [];\n\n // Extract main Laravel config\n const laravelPlugin = findLaravelPlugin(config.plugins || []);\n if (laravelPlugin && laravelPlugin?.config) {\n try {\n const laravelConfig = getLaravelResolvedConfig(laravelPlugin, config, env);\n if (!laravelConfig) throw new Error('Invalid Laravel config');\n moduleConfigs.push({\n name: 'main',\n input: getInputArray(laravelConfig?.build?.rollupOptions?.input || []),\n buildDir: laravelConfig?.build?.buildDir || 'build',\n alias: extractAliases(laravelConfig)\n });\n } catch (error) {\n console.warn('[laravel-modules] Failed to extract Laravel plugin config:', error);\n }\n }\n\n // Extract module metadata\n const { aliases: moduleAliases, moduleConfigs: extractedConfigs } = extractModuleMetadata(modules);\n Object.assign(aliases, moduleAliases);\n moduleConfigs.push(...extractedConfigs);\n\n // Generate rollup inputs\n const rollupInputs = generateRollupInputs(moduleConfigs);\n\n // Merge with main config\n return mergeConfig(config, {\n resolve: {\n alias: aliases\n },\n build: {\n rollupOptions: {\n input: rollupInputs\n }\n }\n });\n },\n\n resolveId(source: string) {\n const ns = parseNamespace(source);\n if (!ns) return null;\n\n const resolved = resolveNamespacedToFs(ns.vendor, ns.pkg, ns.file);\n if (resolved) return resolved;\n\n //this.warn(`[laravel-modules] Not found: ${ns.vendor}:${ns.pkg}::${ns.file}`);\n return null;\n },\n\n writeBundle(_, bundle) {\n const manifestFile = Object.keys(bundle).find(f => f === 'manifest.json');\n if (!manifestFile) return;\n\n const asset = bundle[manifestFile];\n if (asset?.type !== 'asset' || typeof asset.source !== 'string') return;\n\n try {\n const manifest = JSON.parse(asset.source);\n const rewritten: Record<string, unknown> = { ...manifest };\n\n // Add namespaced entries\n for (const [src, data] of Object.entries<unknown>(manifest)) {\n const ns = parseNamespace(src);\n if (ns) {\n const aliasKey = `${ns.vendor}:${ns.pkg}::${ns.file}`;\n rewritten[aliasKey] = data;\n }\n }\n\n\n // Write updated manifest\n asset.source = JSON.stringify(rewritten, null, 2);\n const outDir = _.dir || path.dirname(_.file || '');\n const outPath = path.join(outDir, manifestFile);\n\n fs.writeFileSync(outPath, asset.source, 'utf-8');\n console.log('[laravel-modules] Manifest namespaced keys injected');\n } catch (error) {\n console.warn('[laravel-modules] Failed to process manifest:', error);\n }\n }\n };\n}\n"],"mappings":";AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAYF,SAAR,cAA+B,SAAsC;AACxE,SAAO;AAAA,IACH,MAAM,8BAA8B,QAAQ,IAAI;AAAA,IAChD,QAAQ,MAAM;AACV,YAAM;AAAA,QACF;AAAA,QACA,SAAS;AAAA,QACT,SAAS;AAAA,QACT,SAAS,CAAC,UAAU;AAAA,QACpB,WAAW,SAAS,MAAM,IAAI,IAAI;AAAA,QAClC,eAAe,mBAAmB,IAAI;AAAA,MAC1C,IAAI;AAEJ,YAAM,aAAa,KAAK,QAAQ,YAAY,MAAM,IAAI,IAAI,EAAE;AAC5D,YAAM,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BAAU,QAAQ,IAAI;AAAA,UAC1B;AAAA,QACJ;AAIA,cAAM,SAAS,KAAK,UAAU,WAAW,MAAM,CAAC;AAChD,cAAM,SAAS,EAAE,OAAOD,MAAK,QAAQ,EAAE,QAAQ,EAAE;AACjD,cAAM,UAAUA,MAAK,KAAK,QAAQ,YAAY;AAE9C,QAAAC,IAAG,cAAc,SAAS,MAAM,QAAQ,OAAO;AAC/C,gBAAQ,IAAI,qDAAqD;AAAA,MACrE,SAAS,OAAO;AACZ,gBAAQ,KAAK,iDAAiD,KAAK;AAAA,MACvE;AAAA,IACJ;AAAA,EACJ;AACJ;","names":["path","fs","plugins"]}
|
|
1
|
+
{"version":3,"sources":["../src/laravelModule.ts","../src/laravelModules.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport type { PluginOption } from 'vite'\n\nexport interface ModuleOptions {\n name: string\n vendor?: string\n srcDir?: string\n\n // ✅ Nuevo formato recomendado\n input?: Record<string, string>\n\n // ⚠ Backward compatibility\n inputs?: string[]\n\n buildDir?: string\n publishedDir?: string\n}\n\nexport interface ShardevModuleMeta {\n name: string\n input: Record<string, string>\n buildDir: string\n alias: Record<string, string>\n usePublished: boolean\n}\n\nexport function laravelModule(options: ModuleOptions): PluginOption {\n\n const {\n name,\n vendor = 'shardevcom',\n srcDir = 'resources/react/src',\n input,\n inputs,\n buildDir = `build/${vendor}/${name}`,\n publishedDir = `resources/react/${vendor}/${name}`\n } = options\n\n const root = process.cwd()\n const moduleRoot = path.resolve(root, 'packages', vendor, name)\n\n const relative = path.relative(moduleRoot, root)\n const isModuleRoot =\n !relative || relative === '.' || !relative.startsWith('..')\n\n // ---------------------------------------------------\n // 🔥 Normalización inteligente de inputs\n // ---------------------------------------------------\n\n let normalizedInput: Record<string, string> = {}\n\n if (input && Object.keys(input).length > 0) {\n // Nuevo formato recomendado\n for (const [key, file] of Object.entries(input)) {\n normalizedInput[key] = path.resolve(moduleRoot, file)\n }\n } else {\n // Backward compatibility con inputs: []\n const legacyInputs = inputs ?? ['main.tsx']\n\n legacyInputs.forEach(file => {\n const key = path.parse(file).name\n normalizedInput[key] = path.resolve(moduleRoot, srcDir, file)\n })\n }\n\n // ---------------------------------------------------\n // Published detection\n // ---------------------------------------------------\n\n const publishedPath = path.resolve(root, publishedDir)\n const isPublished = fs.existsSync(publishedPath)\n\n const aliasPath = isPublished\n ? publishedPath\n : path.resolve(moduleRoot, srcDir)\n\n const meta: ShardevModuleMeta = {\n name,\n input: normalizedInput,\n buildDir,\n alias: {\n [`@${vendor}/${name}`]: aliasPath\n },\n usePublished: isPublished\n }\n\n return {\n name: `vite-plugin-laravel-module:${name}`,\n\n // 🔥 Metadata consumida por laravelModules()\n shardevMeta: meta,\n\n config() {\n\n // 🔹 Standalone build\n if (isModuleRoot) {\n return {\n build: {\n outDir: buildDir,\n emptyOutDir: true,\n rollupOptions: {\n input: normalizedInput\n }\n },\n resolve: {\n alias: meta.alias\n }\n }\n }\n\n // 🔹 Integrated mode\n return {\n resolve: {\n alias: meta.alias\n }\n }\n }\n\n } as PluginOption\n}","import type { Plugin, UserConfig, ConfigEnv, ViteDevServer, ModuleNode } from 'vite'\nimport { mergeConfig, createServer } from 'vite'\nimport path from 'path'\nimport fs from 'fs'\n\ninterface LaravelModulesOptions {\n modulesDir?: string\n statusesFile?: string\n debug?: boolean\n useMetaCache?: boolean\n}\n\ninterface ShardevModuleMeta {\n name: string\n input: Record<string, string>\n buildDir: string\n alias: Record<string, string>\n usePublished: boolean\n srcDir: string\n publishedDir?: string\n}\n\nexport function laravelModules(\n options: LaravelModulesOptions = {}\n): Plugin {\n\n const {\n modulesDir = 'packages',\n statusesFile = 'modules.json',\n debug = false,\n useMetaCache = true\n } = options\n\n const root = process.cwd()\n const modulesPath = path.resolve(root, modulesDir)\n const statusesPath = path.resolve(root, statusesFile)\n\n let cachedMetas: ShardevModuleMeta[] = []\n let metaCacheLoaded = false\n\n const log = (...args: any[]) => {\n if (debug) console.log('[laravel-modules]', ...args)\n }\n\n const loadStatuses = (): Record<string, boolean> => {\n if (!fs.existsSync(statusesPath)) return {}\n try {\n return JSON.parse(fs.readFileSync(statusesPath, 'utf-8'))\n } catch {\n return {}\n }\n }\n\n const validateMeta = (meta: ShardevModuleMeta) => {\n if (!meta.name) throw new Error('Module meta missing name')\n if (!meta.srcDir) throw new Error(`Module ${meta.name} missing srcDir`)\n if (!meta.input) throw new Error(`Module ${meta.name} missing input`)\n }\n\n const discoverModules = async (): Promise<ShardevModuleMeta[]> => {\n\n if (useMetaCache && metaCacheLoaded) {\n log('Using cached module metas')\n return cachedMetas\n }\n\n if (!fs.existsSync(modulesPath)) return []\n\n const statuses = loadStatuses()\n const metas: ShardevModuleMeta[] = []\n\n const vendors = fs.readdirSync(modulesPath, { withFileTypes: true })\n .filter(d => d.isDirectory())\n\n for (const vendor of vendors) {\n const vendorPath = path.join(modulesPath, vendor.name)\n\n const packages = fs.readdirSync(vendorPath, { withFileTypes: true })\n .filter(d => d.isDirectory() && statuses[d.name] !== false)\n\n for (const pkg of packages) {\n\n const pkgPath = path.join(vendorPath, pkg.name)\n const viteConfigPath = path.join(pkgPath, 'vite.config.ts')\n\n if (!fs.existsSync(viteConfigPath)) continue\n\n const server = await createServer({\n configFile: viteConfigPath,\n logLevel: 'silent'\n })\n\n const plugins = (server.config.plugins || []) as Plugin[]\n\n for (const plugin of plugins) {\n if (plugin?.name?.startsWith('vite-plugin-laravel-module:')) {\n const meta = (plugin as any).shardevMeta as ShardevModuleMeta\n if (meta) {\n validateMeta(meta)\n metas.push(meta)\n }\n }\n }\n\n await server.close()\n }\n }\n\n cachedMetas = metas\n metaCacheLoaded = true\n\n log('Discovered modules:', metas.map(m => m.name))\n\n return metas\n }\n\n const generateInputs = (metas: ShardevModuleMeta[]) => {\n const inputs: Record<string, string> = {}\n metas.forEach(meta => {\n Object.entries(meta.input).forEach(([key, value]) => {\n inputs[`${meta.name}-${key}`] = value\n })\n })\n return inputs\n }\n\n const resolveWatchPath = (meta: ShardevModuleMeta): string | null => {\n const base = meta.usePublished && meta.publishedDir\n ? meta.publishedDir\n : meta.srcDir\n\n if (!base) return null\n\n return path.isAbsolute(base)\n ? base\n : path.resolve(root, base)\n }\n\n const handleHMR = (\n server: ViteDevServer,\n file: string\n ) => {\n\n const module = server.moduleGraph.getModuleById(file)\n\n if (!module) return\n\n log('HMR update:', file)\n\n const updates = [{\n type: 'js-update',\n path: module.url,\n acceptedPath: module.url,\n timestamp: Date.now()\n }]\n\n server.moduleGraph.invalidateModule(module)\n\n server.ws.send({\n type: 'update',\n updates\n })\n }\n\n return {\n name: 'laravel-modules',\n\n async config(config: UserConfig, env: ConfigEnv) {\n\n const metas = await discoverModules()\n\n const aliases: Record<string, string> = {}\n metas.forEach(meta => Object.assign(aliases, meta.alias))\n\n const rollupInputs = generateInputs(metas)\n\n return mergeConfig(config, {\n resolve: { alias: aliases },\n build: {\n rollupOptions: { input: rollupInputs }\n }\n })\n },\n\n async configureServer(server: ViteDevServer) {\n\n const metas = await discoverModules()\n\n for (const meta of metas) {\n const watchPath = resolveWatchPath(meta)\n if (watchPath && fs.existsSync(watchPath)) {\n server.watcher.add(watchPath)\n log('Watching:', watchPath)\n }\n }\n\n server.watcher.on('change', (file) => {\n\n const matched = metas.some(meta => {\n const watchPath = resolveWatchPath(meta)\n return watchPath && file.startsWith(watchPath)\n })\n\n if (!matched) return\n\n handleHMR(server, file)\n })\n }\n }\n}"],"mappings":";AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AA0BV,SAAS,cAAc,SAAsC;AAEhE,QAAM;AAAA,IACF;AAAA,IACA,SAAS;AAAA,IACT,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA,WAAW,SAAS,MAAM,IAAI,IAAI;AAAA,IAClC,eAAe,mBAAmB,MAAM,IAAI,IAAI;AAAA,EACpD,IAAI;AAEJ,QAAM,OAAO,QAAQ,IAAI;AACzB,QAAM,aAAa,KAAK,QAAQ,MAAM,YAAY,QAAQ,IAAI;AAE9D,QAAM,WA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IAAI;AACvC,iBAAO,aAAa,KAAK,WAAW,SAAS;AAAA,QACjD,CAAC;AAED,YAAI,CAAC,QAAS;AAEd,kBAAU,QAAQ,IAAI;AAAA,MAC1B,CAAC;AAAA,IACL;AAAA,EACJ;AACJ;","names":["path","fs"]}
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shardev/vite-plugin-modular",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"author": "Elbert Tous",
|
|
5
5
|
"description": "Advanced Laravel Modules support for Vite (monorepo + namespace resolver)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
|
-
"main": "./dist/index.cjs
|
|
9
|
-
"module": "./dist/index.
|
|
8
|
+
"main": "./dist/index.cjs",
|
|
9
|
+
"module": "./dist/index.js",
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
|
-
"import": "./dist/index.
|
|
15
|
-
"require": "./dist/index.cjs
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"require": "./dist/index.cjs"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": ">=
|
|
19
|
+
"node": ">=18"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"dist"
|
|
@@ -24,16 +24,21 @@
|
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsup",
|
|
26
26
|
"dev": "tsup --watch",
|
|
27
|
-
"clean": "rm -rf dist"
|
|
27
|
+
"clean": "rm -rf dist",
|
|
28
|
+
"test": "vitest",
|
|
29
|
+
"test:run": "vitest run",
|
|
30
|
+
"test:coverage": "vitest run --coverage"
|
|
28
31
|
},
|
|
29
32
|
"peerDependencies": {
|
|
30
|
-
"vite": "^
|
|
31
|
-
"
|
|
33
|
+
"laravel-vite-plugin": "^2.0.0",
|
|
34
|
+
"vite": "^7.0.0"
|
|
32
35
|
},
|
|
33
36
|
"devDependencies": {
|
|
37
|
+
"@types/node": "^22.0.0",
|
|
34
38
|
"tsup": "^8.0.0",
|
|
35
39
|
"typescript": "^5.7.0",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
40
|
+
"vite": "^7.3.1",
|
|
41
|
+
"vitest": "^4.0.18",
|
|
42
|
+
"@vitest/coverage-v8": "^4.0.18"
|
|
38
43
|
}
|
|
39
44
|
}
|