@zeus-js/bundler-plugin 0.1.0-beta.0

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.
@@ -0,0 +1,565 @@
1
+ /**
2
+ * bundler-plugin v0.1.0-beta.0
3
+ * (c) 2026 baicie
4
+ * Released under the MIT License.
5
+ **/
6
+ Object.defineProperties(exports, {
7
+ __esModule: { value: true },
8
+ [Symbol.toStringTag]: { value: "Module" }
9
+ });
10
+ //#region \0rolldown/runtime.js
11
+ var __create = Object.create;
12
+ var __defProp = Object.defineProperty;
13
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
14
+ var __getOwnPropNames = Object.getOwnPropertyNames;
15
+ var __getProtoOf = Object.getPrototypeOf;
16
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
19
+ key = keys[i];
20
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
21
+ get: ((k) => from[k]).bind(null, key),
22
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
23
+ });
24
+ }
25
+ return to;
26
+ };
27
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ //#endregion
32
+ let node_module = require("node:module");
33
+ let node_path = require("node:path");
34
+ node_path = __toESM(node_path, 1);
35
+ let vite = require("vite");
36
+ let _zeus_js_component_analyzer = require("@zeus-js/component-analyzer");
37
+ let fast_glob = require("fast-glob");
38
+ fast_glob = __toESM(fast_glob, 1);
39
+ let picomatch = require("picomatch");
40
+ picomatch = __toESM(picomatch, 1);
41
+ let node_fs_promises = require("node:fs/promises");
42
+ node_fs_promises = __toESM(node_fs_promises, 1);
43
+ let _babel_core = require("@babel/core");
44
+ let _zeus_js_compiler = require("@zeus-js/compiler");
45
+ _zeus_js_compiler = __toESM(_zeus_js_compiler, 1);
46
+ //#region packages/web-c/bundler-plugin/src/filter.ts
47
+ function cleanUrl(id) {
48
+ return id.replace(/[?#].*$/, "");
49
+ }
50
+ //#endregion
51
+ //#region packages/web-c/bundler-plugin/src/componentTransformFilter.ts
52
+ function normalizePath$1(value) {
53
+ return value.replace(/\\/g, "/");
54
+ }
55
+ function createComponentTransformFilter(options) {
56
+ const isIncluded = (0, picomatch.default)(options.include);
57
+ const isExcluded = (0, picomatch.default)(options.exclude);
58
+ return function shouldTransform(id) {
59
+ const clean = normalizePath$1(cleanUrl(id));
60
+ const relative = normalizePath$1(node_path.default.relative(options.root, clean));
61
+ if (relative.startsWith("..") || node_path.default.isAbsolute(relative)) return false;
62
+ if (isExcluded(relative)) return false;
63
+ return isIncluded(relative);
64
+ };
65
+ }
66
+ //#endregion
67
+ //#region packages/web-c/bundler-plugin/src/defaults.ts
68
+ const DEFAULT_COMPONENT_INCLUDE = ["src/**/*.{ts,tsx,js,jsx}", "components/**/*.{ts,tsx,js,jsx}"];
69
+ const DEFAULT_COMPONENT_EXCLUDE = [
70
+ "**/*.test.*",
71
+ "**/*.spec.*",
72
+ "**/__tests__/**",
73
+ "**/*.d.ts",
74
+ "src/shared/**",
75
+ "node_modules/**",
76
+ "dist/**"
77
+ ];
78
+ function resolveComponentInclude(include) {
79
+ return (include === null || include === void 0 ? void 0 : include.length) ? include : DEFAULT_COMPONENT_INCLUDE;
80
+ }
81
+ function resolveComponentExclude(exclude) {
82
+ return (exclude === null || exclude === void 0 ? void 0 : exclude.length) ? exclude : DEFAULT_COMPONENT_EXCLUDE;
83
+ }
84
+ //#endregion
85
+ //#region packages/web-c/bundler-plugin/src/diagnostics.ts
86
+ function formatDiagnostic(diagnostic) {
87
+ return `[zeus component-analyzer] ${diagnostic.file}: ${diagnostic.message}`;
88
+ }
89
+ function hasErrorDiagnostics(diagnostics) {
90
+ return diagnostics.some((item) => item.level === "error");
91
+ }
92
+ //#endregion
93
+ //#region packages/web-c/bundler-plugin/src/dts.ts
94
+ async function resolveDts(options) {
95
+ var _options$mode;
96
+ const mode = (_options$mode = options.mode) !== null && _options$mode !== void 0 ? _options$mode : "auto";
97
+ if (mode === true) return {
98
+ enabled: true,
99
+ mode,
100
+ reason: ["explicit-enabled"]
101
+ };
102
+ if (mode === false) return {
103
+ enabled: false,
104
+ mode,
105
+ reason: ["explicit-disabled"]
106
+ };
107
+ const reason = [];
108
+ if (await packageDeclaresTypes(options.root)) reason.push("package-types-field");
109
+ if (await hasTypeScriptDependency(options.root)) reason.push("typescript-dependency");
110
+ if (await fileExists(node_path.default.join(options.root, "tsconfig.json"))) reason.push("tsconfig");
111
+ if (await hasTypeScriptSource({
112
+ root: options.root,
113
+ include: options.include,
114
+ exclude: options.exclude
115
+ })) reason.push("typescript-source");
116
+ return {
117
+ enabled: reason.length > 0,
118
+ mode,
119
+ reason
120
+ };
121
+ }
122
+ async function hasTypeScriptDependency(root) {
123
+ const pkg = await readPackageJson(root);
124
+ if (!pkg) return false;
125
+ const deps = {
126
+ ...pkg.dependencies,
127
+ ...pkg.devDependencies,
128
+ ...pkg.peerDependencies,
129
+ ...pkg.optionalDependencies
130
+ };
131
+ return Boolean(deps.typescript);
132
+ }
133
+ async function packageDeclaresTypes(root) {
134
+ const pkg = await readPackageJson(root);
135
+ if (!pkg) return false;
136
+ if (pkg.types || pkg.typings) return true;
137
+ return hasTypesInExports(pkg.exports);
138
+ }
139
+ function hasTypesInExports(value) {
140
+ if (!value) return false;
141
+ if (typeof value !== "object") return false;
142
+ if ("types" in value) return true;
143
+ return Object.values(value).some(hasTypesInExports);
144
+ }
145
+ async function hasTypeScriptSource(options) {
146
+ return (await (0, fast_glob.default)(options.include, {
147
+ cwd: options.root,
148
+ onlyFiles: true,
149
+ absolute: false,
150
+ ignore: options.exclude
151
+ })).some((file) => file.endsWith(".ts") || file.endsWith(".tsx"));
152
+ }
153
+ async function readPackageJson(root) {
154
+ try {
155
+ return JSON.parse(await node_fs_promises.default.readFile(node_path.default.join(root, "package.json"), "utf-8"));
156
+ } catch {
157
+ return null;
158
+ }
159
+ }
160
+ async function fileExists(file) {
161
+ try {
162
+ await node_fs_promises.default.access(file);
163
+ return true;
164
+ } catch {
165
+ return false;
166
+ }
167
+ }
168
+ //#endregion
169
+ //#region packages/web-c/bundler-plugin/src/outputRegistry.ts
170
+ function createOutputRegistry() {
171
+ const map = /* @__PURE__ */ new Map();
172
+ return {
173
+ register(kind, options) {
174
+ map.set(kind, normalizeRegistration(kind, options));
175
+ },
176
+ has(kind) {
177
+ return map.has(kind);
178
+ },
179
+ get(kind) {
180
+ const current = map.get(kind);
181
+ if (!current) throw new Error(`[zeus] output kind "${kind}" is not registered.`);
182
+ return current;
183
+ },
184
+ getDir(kind) {
185
+ return this.get(kind).outDir;
186
+ },
187
+ getFileName(kind, tag) {
188
+ const current = this.get(kind);
189
+ if (current.fileName) return current.fileName(tag, kind);
190
+ return `${normalizeTagName(tag, current.stripPrefix)}.js`;
191
+ },
192
+ join(kind, fileName) {
193
+ return node_path.default.posix.join(this.getDir(kind), fileName);
194
+ }
195
+ };
196
+ }
197
+ function normalizeRegistration(kind, options) {
198
+ var _options$outDir, _options$stripPrefix;
199
+ return {
200
+ outDir: (_options$outDir = options.outDir) !== null && _options$outDir !== void 0 ? _options$outDir : defaultDir(kind),
201
+ stripPrefix: (_options$stripPrefix = options.stripPrefix) !== null && _options$stripPrefix !== void 0 ? _options$stripPrefix : false,
202
+ fileName: options.fileName
203
+ };
204
+ }
205
+ function defaultDir(kind) {
206
+ switch (kind) {
207
+ case "wc": return "wc";
208
+ case "react": return "react";
209
+ case "vue": return "vue";
210
+ case "icons-react": return "icons/react";
211
+ case "icons-vue": return "icons/vue";
212
+ case "icons-wc": return "icons/wc";
213
+ case "asset": return "";
214
+ }
215
+ }
216
+ function normalizeTagName(tag, stripPrefix) {
217
+ if (stripPrefix && tag.startsWith(stripPrefix)) return tag.slice(stripPrefix.length);
218
+ return tag;
219
+ }
220
+ //#endregion
221
+ //#region packages/web-c/bundler-plugin/src/transform.ts
222
+ async function transformZeus(options) {
223
+ var _compiler$moduleName;
224
+ const { id, code, compiler, sourcemap = true } = options;
225
+ const result = await (0, _babel_core.transformAsync)(code, {
226
+ filename: id,
227
+ sourceMaps: sourcemap,
228
+ plugins: [[_zeus_js_compiler.default, {
229
+ moduleName: (_compiler$moduleName = compiler === null || compiler === void 0 ? void 0 : compiler.moduleName) !== null && _compiler$moduleName !== void 0 ? _compiler$moduleName : "@zeus-js/runtime-dom",
230
+ generate: "dom",
231
+ hydratable: false,
232
+ delegateEvents: true,
233
+ ...compiler
234
+ }]],
235
+ parserOpts: {
236
+ sourceType: "module",
237
+ plugins: ["typescript", "jsx"]
238
+ },
239
+ generatorOpts: {
240
+ retainLines: false,
241
+ compact: false,
242
+ jsescOption: { minimal: true }
243
+ }
244
+ });
245
+ if (!(result === null || result === void 0 ? void 0 : result.code)) return null;
246
+ return {
247
+ code: result.code,
248
+ map: result.map
249
+ };
250
+ }
251
+ //#endregion
252
+ //#region packages/web-c/bundler-plugin/src/virtual.ts
253
+ const RESOLVED_VIRTUAL_PREFIX = "\0";
254
+ var VirtualModuleRegistry = class {
255
+ constructor() {
256
+ this.modules = /* @__PURE__ */ new Map();
257
+ this.virtualDirs = /* @__PURE__ */ new Map();
258
+ this.virtualFileNames = /* @__PURE__ */ new Map();
259
+ this.idsByFileName = /* @__PURE__ */ new Map();
260
+ }
261
+ set(id, code, fileName) {
262
+ const normalized = normalizeVirtualId(id);
263
+ this.modules.set(normalized, code);
264
+ if (fileName) {
265
+ const dir = node_path.default.posix.dirname(fileName);
266
+ this.virtualDirs.set(normalized, dir);
267
+ const normalizedFileName = normalizePath(fileName);
268
+ this.virtualFileNames.set(normalized, normalizedFileName);
269
+ this.idsByFileName.set(normalizedFileName, normalized);
270
+ }
271
+ }
272
+ has(id) {
273
+ return this.modules.has(normalizeVirtualId(id));
274
+ }
275
+ get(id) {
276
+ return this.modules.get(normalizeVirtualId(id));
277
+ }
278
+ clear() {
279
+ this.modules.clear();
280
+ this.virtualDirs.clear();
281
+ this.virtualFileNames.clear();
282
+ this.idsByFileName.clear();
283
+ }
284
+ resolve(id, importer) {
285
+ const normalized = normalizeVirtualId(id);
286
+ if (this.modules.has(normalized)) return RESOLVED_VIRTUAL_PREFIX + normalized;
287
+ if (importer && (id.startsWith(".") || id.startsWith(".."))) {
288
+ const importerNormalized = normalizeVirtualId(importer);
289
+ const importerDir = this.virtualDirs.get(importerNormalized);
290
+ if (importerDir) {
291
+ const resolved = normalizePath(node_path.default.posix.join(importerDir, id));
292
+ const resolvedVirtualId = this.idsByFileName.get(resolved);
293
+ if (resolvedVirtualId) return RESOLVED_VIRTUAL_PREFIX + resolvedVirtualId;
294
+ const importingPrefix = this.getIdPrefix(importerNormalized);
295
+ if (importingPrefix !== null) {
296
+ const baseName = node_path.default.posix.basename(resolved, ".js");
297
+ for (const [key] of this.modules.entries()) if (key === importingPrefix + baseName) return RESOLVED_VIRTUAL_PREFIX + key;
298
+ for (const stripPrefix of [
299
+ "z-",
300
+ "wc-",
301
+ "wc/",
302
+ ""
303
+ ]) {
304
+ const candidate = stripPrefix ? importingPrefix + stripPrefix + baseName : importingPrefix + baseName;
305
+ if (this.modules.has(candidate)) return RESOLVED_VIRTUAL_PREFIX + candidate;
306
+ }
307
+ const fullName = baseName;
308
+ for (const [key] of this.modules.entries()) if (key.endsWith(":" + fullName)) return RESOLVED_VIRTUAL_PREFIX + key;
309
+ }
310
+ }
311
+ }
312
+ return null;
313
+ }
314
+ getIdPrefix(virtualId) {
315
+ const lastColon = virtualId.lastIndexOf(":");
316
+ if (lastColon <= 0) return null;
317
+ return virtualId.slice(0, lastColon + 1);
318
+ }
319
+ load(id) {
320
+ var _this$modules$get;
321
+ if (!id.startsWith(RESOLVED_VIRTUAL_PREFIX)) return null;
322
+ const normalized = id.slice(1);
323
+ return (_this$modules$get = this.modules.get(normalized)) !== null && _this$modules$get !== void 0 ? _this$modules$get : null;
324
+ }
325
+ };
326
+ function normalizeVirtualId(id) {
327
+ return id.startsWith("\0") ? id.slice(1) : id;
328
+ }
329
+ function normalizePath(value) {
330
+ return value.replace(/\\/g, "/").replace(/^\.\//, "");
331
+ }
332
+ //#endregion
333
+ //#region packages/web-c/bundler-plugin/src/rollup.ts
334
+ function createZeusPlugin(options = {}) {
335
+ let shouldTransform = (_id) => false;
336
+ const virtualModules = new VirtualModuleRegistry();
337
+ let ctx;
338
+ return {
339
+ name: "zeus-bundler-plugin",
340
+ async buildStart() {
341
+ var _options$components, _options$components2, _options$plugins;
342
+ virtualModules.clear();
343
+ const root = resolveRoot(options.root);
344
+ const include = resolveComponentInclude((_options$components = options.components) === null || _options$components === void 0 ? void 0 : _options$components.include);
345
+ const exclude = resolveComponentExclude((_options$components2 = options.components) === null || _options$components2 === void 0 ? void 0 : _options$components2.exclude);
346
+ shouldTransform = createComponentTransformFilter({
347
+ root,
348
+ include,
349
+ exclude
350
+ });
351
+ const dts = await resolveDts({
352
+ root,
353
+ mode: options.dts,
354
+ include,
355
+ exclude
356
+ });
357
+ const manifestResult = await createManifest(root, include, exclude);
358
+ for (const file of await collectWatchFiles(root, include, exclude)) this.addWatchFile(file);
359
+ const diagnostics = manifestResult.diagnostics;
360
+ for (const diagnostic of diagnostics) {
361
+ const message = formatDiagnostic(diagnostic);
362
+ if (diagnostic.level === "error") this.error(message);
363
+ else if (options.diagnostics !== false) this.warn(message);
364
+ }
365
+ if (hasErrorDiagnostics(diagnostics)) this.error("[zeus] component analyzer failed.");
366
+ if (options.diagnostics === "verbose") this.warn(`[zeus] dts ${dts.enabled ? "enabled" : "disabled"}: ${dts.reason.join(", ") || "no signal"}`);
367
+ const outputs = createOutputRegistry();
368
+ ctx = {
369
+ root,
370
+ manifest: manifestResult.manifest,
371
+ diagnostics,
372
+ dts,
373
+ outputs,
374
+ emitFile: this.emitFile.bind(this),
375
+ warn: this.warn.bind(this),
376
+ error: this.error.bind(this),
377
+ addWatchFile: this.addWatchFile.bind(this),
378
+ meta: { watchMode: this.meta.watchMode }
379
+ };
380
+ const plugins = (_options$plugins = options.plugins) !== null && _options$plugins !== void 0 ? _options$plugins : [];
381
+ for (const plugin of plugins) {
382
+ var _plugin$setup;
383
+ await ((_plugin$setup = plugin.setup) === null || _plugin$setup === void 0 ? void 0 : _plugin$setup.call(plugin, ctx));
384
+ }
385
+ for (const plugin of plugins) {
386
+ var _plugin$buildStart;
387
+ await ((_plugin$buildStart = plugin.buildStart) === null || _plugin$buildStart === void 0 ? void 0 : _plugin$buildStart.call(plugin, ctx));
388
+ }
389
+ for (const plugin of plugins) {
390
+ var _plugin$virtualModule;
391
+ const modules = await ((_plugin$virtualModule = plugin.virtualModules) === null || _plugin$virtualModule === void 0 ? void 0 : _plugin$virtualModule.call(plugin, ctx));
392
+ if (!modules) continue;
393
+ for (const mod of modules) virtualModules.set(mod.id, mod.code, mod.fileName);
394
+ emitVirtualEntries(modules, this);
395
+ }
396
+ },
397
+ resolveId(id, importer) {
398
+ const resolved = virtualModules.resolve(id, importer);
399
+ if (resolved) return {
400
+ id: resolved,
401
+ moduleSideEffects: "no-treeshake"
402
+ };
403
+ return null;
404
+ },
405
+ load(id) {
406
+ return virtualModules.load(id);
407
+ },
408
+ async transform(code, id) {
409
+ if (!shouldTransform(id)) return null;
410
+ const result = await transformZeus({
411
+ id,
412
+ code,
413
+ compiler: options.compiler,
414
+ sourcemap: true
415
+ });
416
+ if (!result) return null;
417
+ return result;
418
+ },
419
+ async generateBundle(_, bundle) {
420
+ var _options$plugins2;
421
+ if (!ctx) return;
422
+ const plugins = (_options$plugins2 = options.plugins) !== null && _options$plugins2 !== void 0 ? _options$plugins2 : [];
423
+ for (const plugin of plugins) {
424
+ var _plugin$generateBundl;
425
+ const files = await ((_plugin$generateBundl = plugin.generateBundle) === null || _plugin$generateBundl === void 0 ? void 0 : _plugin$generateBundl.call(plugin, ctx, bundle));
426
+ if (!files) continue;
427
+ for (const file of files) emitOutputFile(this, file);
428
+ }
429
+ }
430
+ };
431
+ }
432
+ async function createManifest(root, include, exclude) {
433
+ if (!include.length) return {
434
+ manifest: {
435
+ version: 1,
436
+ components: []
437
+ },
438
+ diagnostics: []
439
+ };
440
+ return await (0, _zeus_js_component_analyzer.analyzeComponents)({
441
+ root,
442
+ include,
443
+ exclude
444
+ });
445
+ }
446
+ async function collectWatchFiles(root, include, exclude) {
447
+ if (!include.length) return [];
448
+ return await (0, fast_glob.default)(include, {
449
+ cwd: root,
450
+ absolute: true,
451
+ ignore: exclude
452
+ });
453
+ }
454
+ function resolveRoot(root) {
455
+ if (typeof root === "function") return node_path.default.resolve(root());
456
+ return node_path.default.resolve(root !== null && root !== void 0 ? root : process.cwd());
457
+ }
458
+ function emitOutputFile(pluginContext, file) {
459
+ if (file.type === "asset") {
460
+ pluginContext.emitFile({
461
+ type: "asset",
462
+ fileName: file.fileName,
463
+ source: file.source
464
+ });
465
+ return;
466
+ }
467
+ pluginContext.emitFile({
468
+ type: "chunk",
469
+ id: file.id,
470
+ fileName: file.fileName
471
+ });
472
+ }
473
+ function emitVirtualEntries(modules, pluginContext) {
474
+ for (const mod of modules) {
475
+ if (!mod.fileName) continue;
476
+ pluginContext.emitFile({
477
+ type: "chunk",
478
+ id: mod.id,
479
+ fileName: mod.fileName,
480
+ preserveSignature: "strict"
481
+ });
482
+ }
483
+ }
484
+ //#endregion
485
+ //#region packages/web-c/bundler-plugin/src/vite.ts
486
+ function createZeusVitePlugin(options = {}) {
487
+ var _options$root;
488
+ let resolvedConfig;
489
+ return {
490
+ ...createZeusPlugin({
491
+ ...options,
492
+ root: (_options$root = options.root) !== null && _options$root !== void 0 ? _options$root : (() => {
493
+ var _resolvedConfig$root;
494
+ return (_resolvedConfig$root = resolvedConfig === null || resolvedConfig === void 0 ? void 0 : resolvedConfig.root) !== null && _resolvedConfig$root !== void 0 ? _resolvedConfig$root : process.cwd();
495
+ })
496
+ }),
497
+ name: "vite-plugin-zeus",
498
+ enforce: "pre",
499
+ async config(userConfig) {
500
+ const runtimeDomEntry = resolveRuntimeDOMEntry(userConfig.root);
501
+ const pluginExternals = collectPluginExternals(options);
502
+ const pluginConfig = {
503
+ ...await isRolldownVite() ? { oxc: { jsx: "preserve" } } : { esbuild: { jsx: "preserve" } },
504
+ resolve: {
505
+ alias: runtimeDomEntry ? { "@zeus-js/runtime-dom": runtimeDomEntry } : void 0,
506
+ dedupe: [
507
+ "@zeus-js/signal",
508
+ "@zeus-js/runtime-dom",
509
+ "@zeus-js/zeus",
510
+ "@zeus-js/component-dts"
511
+ ]
512
+ }
513
+ };
514
+ if (pluginExternals.length) {
515
+ var _userConfig$build;
516
+ return (0, vite.mergeConfig)(pluginConfig, { build: { rollupOptions: { external: mergeExternal((_userConfig$build = userConfig.build) === null || _userConfig$build === void 0 || (_userConfig$build = _userConfig$build.rollupOptions) === null || _userConfig$build === void 0 ? void 0 : _userConfig$build.external, pluginExternals) } } });
517
+ }
518
+ return pluginConfig;
519
+ },
520
+ configResolved(config) {
521
+ resolvedConfig = config;
522
+ }
523
+ };
524
+ }
525
+ function collectPluginExternals(options) {
526
+ var _options$plugins;
527
+ const set = /* @__PURE__ */ new Set();
528
+ for (const plugin of (_options$plugins = options.plugins) !== null && _options$plugins !== void 0 ? _options$plugins : []) {
529
+ var _plugin$external;
530
+ for (const dep of (_plugin$external = plugin.external) !== null && _plugin$external !== void 0 ? _plugin$external : []) set.add(dep);
531
+ }
532
+ return Array.from(set);
533
+ }
534
+ function mergeExternal(userExternal, pluginExternal) {
535
+ if (!userExternal) return pluginExternal;
536
+ if (typeof userExternal === "function") return (source, importer, isResolved) => {
537
+ return pluginExternal.includes(source) || userExternal(source, importer, isResolved);
538
+ };
539
+ return [...Array.isArray(userExternal) ? userExternal : [userExternal], ...pluginExternal];
540
+ }
541
+ async function isRolldownVite() {
542
+ try {
543
+ const vite$1 = await import("vite");
544
+ return typeof vite$1.rolldownVersion === "string" || typeof vite$1.transformWithOxc === "function";
545
+ } catch {
546
+ return false;
547
+ }
548
+ }
549
+ function resolveRuntimeDOMEntry(root) {
550
+ const projectRoot = node_path.default.resolve(process.cwd(), root !== null && root !== void 0 ? root : ".");
551
+ const requireFromProject = (0, node_module.createRequire)(node_path.default.join(projectRoot, "package.json"));
552
+ try {
553
+ return requireFromProject.resolve("@zeus-js/runtime-dom/dist/runtime-dom.esm-bundler.js");
554
+ } catch {}
555
+ try {
556
+ return (0, node_module.createRequire)(requireFromProject.resolve("@zeus-js/zeus")).resolve("@zeus-js/runtime-dom/dist/runtime-dom.esm-bundler.js");
557
+ } catch {
558
+ return;
559
+ }
560
+ }
561
+ //#endregion
562
+ exports.createZeusVitePlugin = createZeusVitePlugin;
563
+ exports.default = createZeusVitePlugin;
564
+ exports.zeus = createZeusVitePlugin;
565
+ exports.mergeExternal = mergeExternal;
package/dist/vite.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import type { RollupExternalOption, ZeusBundlerPluginOptions } from './types';
2
+ import type { Plugin } from 'vite';
3
+
4
+ export default createZeusVitePlugin;
5
+ export { createZeusVitePlugin as zeus };
6
+