@fluenti/vite-plugin 0.3.3 → 0.4.0-rc.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.
package/dist/index.js CHANGED
@@ -50,7 +50,7 @@ async function _(e) {
50
50
  }
51
51
  }
52
52
  }
53
- function ee(e, t = 300) {
53
+ function v(e, t = 300) {
54
54
  let n = null, r = !1, i = !1;
55
55
  async function a() {
56
56
  r = !0;
@@ -69,27 +69,27 @@ function ee(e, t = 300) {
69
69
  }
70
70
  //#endregion
71
71
  //#region src/build-transform.ts
72
- function te(e, t) {
73
- return v(e, "dynamic", t);
72
+ function ee(e, t) {
73
+ return y(e, "dynamic", t);
74
74
  }
75
- function ne(e, t) {
76
- return v(e, "static", t);
75
+ function te(e, t) {
76
+ return y(e, "static", t);
77
77
  }
78
- function v(e, n, r) {
78
+ function y(e, n, r) {
79
79
  let i = r?.hashFn ?? t, a = l(e);
80
80
  if (!a || a.type !== "Program") return {
81
81
  code: e,
82
82
  needsCatalogImport: !1,
83
83
  usedHashes: /* @__PURE__ */ new Set()
84
84
  };
85
- let o = y(a), s = [], c = /* @__PURE__ */ new Set();
85
+ let o = b(a), s = [], c = /* @__PURE__ */ new Set();
86
86
  if (u(a, (t) => {
87
- let r = x(e, t, o, n, c, i);
87
+ let r = S(e, t, o, n, c, i);
88
88
  if (r) {
89
89
  s.push(r);
90
90
  return;
91
91
  }
92
- w(t, c, i);
92
+ ne(t, c, i);
93
93
  }), s.length === 0) return {
94
94
  code: e,
95
95
  needsCatalogImport: !1,
@@ -106,32 +106,32 @@ function v(e, n, r) {
106
106
  usedHashes: c
107
107
  };
108
108
  }
109
- function y(e) {
109
+ function b(e) {
110
110
  let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
111
- for (let t of e.body) if (re(t)) for (let e of t.specifiers) {
112
- if (!ie(e)) continue;
113
- let t = le(e);
111
+ for (let t of e.body) if (se(t)) for (let e of t.specifiers) {
112
+ if (!ce(e)) continue;
113
+ let t = B(e);
114
114
  t && (t === "useI18n" && n.add(e.local.name), t === "getI18n" && r.add(e.local.name), t === "unref" && i.add(e.local.name));
115
115
  }
116
116
  return u(e, (e) => {
117
- if (!ae(e) || !e.init || !oe(e.id)) return;
118
- if (z(e.init) && B(e.init.callee) && n.has(e.init.callee.name)) {
119
- b(e.id, t);
117
+ if (!le(e) || !e.init || !ue(e.id)) return;
118
+ if (F(e.init) && L(e.init.callee) && n.has(e.init.callee.name)) {
119
+ x(e.id, t);
120
120
  return;
121
121
  }
122
122
  let i = e.init.type === "AwaitExpression" ? e.init.argument : null;
123
- i && z(i) && B(i.callee) && r.has(i.callee.name) && b(e.id, t);
123
+ i && F(i) && L(i.callee) && r.has(i.callee.name) && x(e.id, t);
124
124
  }), {
125
125
  tracked: t,
126
126
  unref: i
127
127
  };
128
128
  }
129
- function b(e, t) {
130
- for (let n of e.properties) !R(n) || n.computed || !B(n.key) || n.key.name !== "t" || B(n.value) && t.add(n.value.name);
129
+ function x(e, t) {
130
+ for (let n of e.properties) !P(n) || n.computed || !L(n.key) || n.key.name !== "t" || L(n.value) && t.add(n.value.name);
131
131
  }
132
- function x(e, t, n, r, i, a) {
133
- if (!z(t) || t.start == null || t.end == null) return;
134
- let o = S(e, t, n, a);
132
+ function S(e, t, n, r, i, a) {
133
+ if (!F(t) || t.start == null || t.end == null) return;
134
+ let o = C(e, t, n, a);
135
135
  if (!o) return;
136
136
  let { catalogId: s } = o;
137
137
  i.add(s);
@@ -142,11 +142,11 @@ function x(e, t, n, r, i, a) {
142
142
  replacement: u
143
143
  };
144
144
  }
145
- function S(e, t, n, r) {
145
+ function C(e, t, n, r) {
146
146
  if (t.arguments.length === 0) return;
147
- let i = t.callee, a = B(i) && (n.tracked.has(i.name) || i.name === "$t"), o = se(i) && !i.computed && B(i.property) && (i.property.name === "$t" || i.property.name === "t" && B(i.object) && (i.object.name === "_ctx" || i.object.name === "$setup")), s = z(i) && B(i.callee) && n.unref.has(i.callee.name) && i.arguments.length === 1 && B(i.arguments[0]) && n.tracked.has(i.arguments[0].name);
147
+ let i = t.callee, a = L(i) && (n.tracked.has(i.name) || i.name === "$t"), o = I(i) && !i.computed && L(i.property) && (i.property.name === "$t" || i.property.name === "t" && L(i.object) && (i.object.name === "_ctx" || i.object.name === "$setup")), s = F(i) && L(i.callee) && n.unref.has(i.callee.name) && i.arguments.length === 1 && L(i.arguments[0]) && n.tracked.has(i.arguments[0].name);
148
148
  if (!a && !o && !s) return;
149
- let c = C(t.arguments[0], r);
149
+ let c = w(t.arguments[0], r);
150
150
  if (!c) return;
151
151
  let l = t.arguments[1] && t.arguments[1].start != null && t.arguments[1].end != null ? e.slice(t.arguments[1].start, t.arguments[1].end) : void 0;
152
152
  return l === void 0 ? { catalogId: c } : {
@@ -154,69 +154,69 @@ function S(e, t, n, r) {
154
154
  valuesSource: l
155
155
  };
156
156
  }
157
- function C(e, t) {
158
- let n = F(e);
157
+ function w(e, t) {
158
+ let n = j(e);
159
159
  if (n !== void 0) return t(n);
160
- if (!L(e)) return;
160
+ if (!N(e)) return;
161
161
  let r, i, a;
162
162
  for (let t of e.properties) {
163
- if (!R(t) || t.computed) continue;
164
- let e = I(t.key);
163
+ if (!P(t) || t.computed) continue;
164
+ let e = M(t.key);
165
165
  if (!e) continue;
166
- let n = F(t.value);
166
+ let n = j(t.value);
167
167
  n !== void 0 && (e === "id" && (r = n), e === "message" && (i = n), e === "context" && (a = n));
168
168
  }
169
169
  if (r) return r;
170
170
  if (i) return t(i, a);
171
171
  }
172
- function w(e, t, n) {
173
- if (!ce(e)) return;
174
- let r = P(e.openingElement.name);
172
+ function ne(e, t, n) {
173
+ if (!R(e)) return;
174
+ let r = oe(e.openingElement.name);
175
175
  if (r) {
176
176
  if (r === "Trans") {
177
- let r = A(e.openingElement, "__id") ?? A(e.openingElement, "id");
177
+ let r = O(e.openingElement, "__id") ?? O(e.openingElement, "id");
178
178
  if (r) {
179
179
  t.add(r);
180
180
  return;
181
181
  }
182
- let i = A(e.openingElement, "__message"), a = A(e.openingElement, "context");
182
+ let i = O(e.openingElement, "__message"), a = O(e.openingElement, "context");
183
183
  i && t.add(n(i, a));
184
184
  return;
185
185
  }
186
186
  if (r === "Plural") {
187
- let r = T(e.openingElement, n);
187
+ let r = re(e.openingElement, n);
188
188
  r && t.add(r);
189
189
  return;
190
190
  }
191
191
  if (r === "Select") {
192
- let r = E(e.openingElement, n);
192
+ let r = ie(e.openingElement, n);
193
193
  r && t.add(r);
194
194
  }
195
195
  }
196
196
  }
197
- function T(e, t) {
198
- let n = A(e, "id");
197
+ function re(e, t) {
198
+ let n = O(e, "id");
199
199
  if (n) return n;
200
- let r = A(e, "context"), i = j(e, "offset"), a = [
201
- A(e, "zero") === void 0 ? void 0 : `=0 {${A(e, "zero")}}`,
202
- A(e, "one") === void 0 ? void 0 : `one {${A(e, "one")}}`,
203
- A(e, "two") === void 0 ? void 0 : `two {${A(e, "two")}}`,
204
- A(e, "few") === void 0 ? void 0 : `few {${A(e, "few")}}`,
205
- A(e, "many") === void 0 ? void 0 : `many {${A(e, "many")}}`,
206
- A(e, "other") === void 0 ? void 0 : `other {${A(e, "other")}}`
200
+ let r = O(e, "context"), i = ae(e, "offset"), a = [
201
+ O(e, "zero") === void 0 ? void 0 : `=0 {${O(e, "zero")}}`,
202
+ O(e, "one") === void 0 ? void 0 : `one {${O(e, "one")}}`,
203
+ O(e, "two") === void 0 ? void 0 : `two {${O(e, "two")}}`,
204
+ O(e, "few") === void 0 ? void 0 : `few {${O(e, "few")}}`,
205
+ O(e, "many") === void 0 ? void 0 : `many {${O(e, "many")}}`,
206
+ O(e, "other") === void 0 ? void 0 : `other {${O(e, "other")}}`
207
207
  ].filter(Boolean);
208
208
  if (a.length !== 0) return t(`{count, plural,${typeof i == "number" ? ` offset:${i}` : ""} ${a.join(" ")}}`, r);
209
209
  }
210
- function E(e, t) {
211
- let n = A(e, "id");
210
+ function ie(e, t) {
211
+ let n = O(e, "id");
212
212
  if (n) return n;
213
- let r = A(e, "context"), i = D(e);
213
+ let r = O(e, "context"), i = T(e);
214
214
  if (!(!i || i.other === void 0)) return t(`{value, select, ${[...Object.keys(i).filter((e) => e !== "other").sort(), "other"].map((e) => `${e} {${i[e]}}`).join(" ")}}`, r);
215
215
  }
216
- function D(e) {
217
- let t = k(e, "options");
216
+ function T(e) {
217
+ let t = D(e, "options");
218
218
  if (t) {
219
- let n = A(e, "other");
219
+ let n = O(e, "other");
220
220
  return {
221
221
  ...t,
222
222
  ...n === void 0 ? {} : { other: n }
@@ -224,7 +224,7 @@ function D(e) {
224
224
  }
225
225
  let n = {};
226
226
  for (let t of e.attributes) {
227
- if (!V(t)) continue;
227
+ if (!z(t)) continue;
228
228
  let e = t.name.name;
229
229
  if ([
230
230
  "value",
@@ -233,97 +233,97 @@ function D(e) {
233
233
  "comment",
234
234
  "options"
235
235
  ].includes(e)) continue;
236
- let r = N(t);
236
+ let r = A(t);
237
237
  r !== void 0 && (n[e] = r);
238
238
  }
239
239
  return Object.keys(n).length > 0 ? n : void 0;
240
240
  }
241
- function O(e) {
242
- if (!L(e)) return;
241
+ function E(e) {
242
+ if (!N(e)) return;
243
243
  let t = {};
244
244
  for (let n of e.properties) {
245
- if (!R(n) || n.computed) return;
246
- let e = I(n.key), r = F(n.value);
245
+ if (!P(n) || n.computed) return;
246
+ let e = M(n.key), r = j(n.value);
247
247
  if (!e || r === void 0) return;
248
248
  t[e] = r;
249
249
  }
250
250
  return t;
251
251
  }
252
- function k(e, t) {
253
- let n = M(e, t);
254
- if (n?.value && n.value.type === "JSXExpressionContainer") return O(n.value.expression);
252
+ function D(e, t) {
253
+ let n = k(e, t);
254
+ if (n?.value && n.value.type === "JSXExpressionContainer") return E(n.value.expression);
255
255
  }
256
- function A(e, t) {
257
- return N(M(e, t));
256
+ function O(e, t) {
257
+ return A(k(e, t));
258
258
  }
259
- function j(e, t) {
260
- let n = M(e, t);
259
+ function ae(e, t) {
260
+ let n = k(e, t);
261
261
  if (!n?.value || n.value.type !== "JSXExpressionContainer") return;
262
262
  let r = n.value.expression;
263
263
  return r.type === "NumericLiteral" ? r.value : void 0;
264
264
  }
265
- function M(e, t) {
266
- return e.attributes.find((e) => V(e) && e.name.name === t);
265
+ function k(e, t) {
266
+ return e.attributes.find((e) => z(e) && e.name.name === t);
267
267
  }
268
- function N(e) {
268
+ function A(e) {
269
269
  if (e?.value) {
270
270
  if (e.value.type === "StringLiteral") return e.value.value;
271
- if (e.value.type === "JSXExpressionContainer") return F(e.value.expression);
271
+ if (e.value.type === "JSXExpressionContainer") return j(e.value.expression);
272
272
  }
273
273
  }
274
- function P(e) {
274
+ function oe(e) {
275
275
  return e.type === "JSXIdentifier" ? e.name : void 0;
276
276
  }
277
- function F(e) {
277
+ function j(e) {
278
278
  if (e.type === "StringLiteral") return e.value;
279
279
  if (e.type === "TemplateLiteral") {
280
280
  let t = e;
281
281
  if (t.expressions.length === 0 && t.quasis.length === 1) return t.quasis[0].value.cooked ?? t.quasis[0].value.raw;
282
282
  }
283
283
  }
284
- function I(e) {
285
- if (B(e)) return e.name;
284
+ function M(e) {
285
+ if (L(e)) return e.name;
286
286
  if (e.type === "StringLiteral") return e.value;
287
287
  }
288
- function re(e) {
288
+ function se(e) {
289
289
  return e.type === "ImportDeclaration";
290
290
  }
291
- function ie(e) {
291
+ function ce(e) {
292
292
  return e.type === "ImportSpecifier";
293
293
  }
294
- function ae(e) {
294
+ function le(e) {
295
295
  return e.type === "VariableDeclarator";
296
296
  }
297
- function oe(e) {
297
+ function ue(e) {
298
298
  return e.type === "ObjectPattern";
299
299
  }
300
- function L(e) {
300
+ function N(e) {
301
301
  return e.type === "ObjectExpression";
302
302
  }
303
- function R(e) {
303
+ function P(e) {
304
304
  return e.type === "ObjectProperty";
305
305
  }
306
- function z(e) {
306
+ function F(e) {
307
307
  return e.type === "CallExpression";
308
308
  }
309
- function se(e) {
309
+ function I(e) {
310
310
  return e.type === "MemberExpression";
311
311
  }
312
- function B(e) {
312
+ function L(e) {
313
313
  return e?.type === "Identifier";
314
314
  }
315
- function ce(e) {
315
+ function R(e) {
316
316
  return e.type === "JSXElement";
317
317
  }
318
- function V(e) {
318
+ function z(e) {
319
319
  return e.type === "JSXAttribute";
320
320
  }
321
- function le(e) {
321
+ function B(e) {
322
322
  let t = e.imported;
323
323
  if (t.type === "Identifier") return t.name;
324
324
  if (t.type === "StringLiteral") return t.value;
325
325
  }
326
- function ue(e, n, r, i) {
326
+ function V(e, n, r, i) {
327
327
  if (n === "dynamic") return `import { __catalog } from 'virtual:fluenti/runtime';\n${e}`;
328
328
  if (n === "per-route") return `import { __catalog } from 'virtual:fluenti/route-runtime';\n${e}`;
329
329
  let a = i ?? t;
@@ -433,50 +433,69 @@ function $(e, t) {
433
433
  return n(typeof e == "string" ? e : void 0, t);
434
434
  }
435
435
  function Se(t, r, a) {
436
- let o;
437
- function l(e) {
438
- return o ||= $(t.config, e), o;
436
+ let o, l = process.cwd();
437
+ function u(e) {
438
+ let n = e ?? l;
439
+ return o ||= $(t.config, n), o;
440
+ }
441
+ let d = t.framework;
442
+ function f(e) {
443
+ let t = u(e), r = t.compileOutDir.replace(/^\.\//, ""), i = t.catalogExtension ?? ".js", a = t.splitting ?? !1, o = t.sourceLocale;
444
+ return {
445
+ config: t,
446
+ catalogDir: r,
447
+ catalogExtension: i,
448
+ splitting: a,
449
+ sourceLocale: o,
450
+ localeCodes: n(t.locales),
451
+ defaultBuildLocale: t.defaultBuildLocale ?? o
452
+ };
439
453
  }
440
- let u = $(t.config), d = u.compileOutDir.replace(/^\.\//, ""), f = u.catalogExtension ?? ".js", p = t.framework, v = u.splitting ?? !1, y = u.sourceLocale, b = n(u.locales), x = u.defaultBuildLocale ?? y, S = u.idGenerator, C = u.onBeforeCompile, w = u.onAfterCompile, T = process.cwd(), E = {
454
+ let p = {
441
455
  name: "fluenti:virtual",
442
456
  configResolved(e) {
443
- T = e.root, m(e.command);
457
+ l = e.root, o = $(t.config, l), m(e.command);
444
458
  },
445
459
  resolveId(e) {
446
460
  if (e.startsWith(be)) return "\0" + e;
447
- if (v) {
461
+ let { splitting: t } = f();
462
+ if (t) {
448
463
  let t = q(e);
449
464
  if (t) return t;
450
465
  }
451
466
  },
452
467
  load(e) {
453
- if (e.startsWith(xe)) return `export { default } from '${`${d}/${e.slice(26)}${f}`}'`;
454
- if (v) {
455
- let t = J(e, {
456
- rootDir: T,
457
- catalogDir: d,
458
- catalogExtension: f,
459
- locales: b,
460
- sourceLocale: y,
461
- defaultBuildLocale: x,
462
- framework: p,
468
+ let { catalogDir: t, catalogExtension: n, splitting: r, localeCodes: i, sourceLocale: o, defaultBuildLocale: s } = f();
469
+ if (e.startsWith(xe)) {
470
+ let r = e.slice(26);
471
+ return i.includes(r) ? `export { default } from '${`${t}/${r}${n}`}'` : void 0;
472
+ }
473
+ if (r) {
474
+ let r = J(e, {
475
+ rootDir: l,
476
+ catalogDir: t,
477
+ catalogExtension: n,
478
+ locales: i,
479
+ sourceLocale: o,
480
+ defaultBuildLocale: s,
481
+ framework: d,
463
482
  runtimeGenerator: a
464
483
  });
465
- if (t) return t;
484
+ if (r) return r;
466
485
  }
467
486
  }
468
- }, D = s({ framework: p }), O = {
487
+ }, y = s({ framework: d }), b = {
469
488
  name: "fluenti:script-transform",
470
489
  enforce: "pre",
471
490
  transform(e, t) {
472
491
  if (t.includes("node_modules") || !t.match(/\.(vue|tsx|jsx|ts|js)(\?|$)/) || t.includes(".vue") && !t.includes("type=script")) return;
473
- let n = p === "vue" && t.includes(".vue"), r = e, i = !1;
492
+ let n = d === "vue" && t.includes(".vue"), r = e, i = !1;
474
493
  if (t.match(/\.[jt]sx(\?|$)/) && /<Trans[\s>]/.test(r)) {
475
- let e = D.transformTrans(r);
494
+ let e = y.transformTrans(r);
476
495
  e.transformed && (r = e.code, i = !0);
477
496
  }
478
497
  if (c(r)) {
479
- let e = D.transformScope(r, n ? { allowTopLevelImportedT: !0 } : void 0);
498
+ let e = y.transformScope(r, n ? { allowTopLevelImportedT: !0 } : void 0);
480
499
  if (e.transformed) return {
481
500
  code: e.code,
482
501
  map: null
@@ -487,56 +506,61 @@ function Se(t, r, a) {
487
506
  map: null
488
507
  } : void 0;
489
508
  }
490
- }, k = /* @__PURE__ */ new Map(), A = {
509
+ }, x = /* @__PURE__ */ new Map(), S = {
491
510
  name: "fluenti:build-split",
492
511
  transform(e, t) {
493
- if (!v || !g(h(this)) || t.includes("node_modules") || !t.match(/\.(vue|tsx|jsx|ts|js)(\?|$)/)) return;
494
- let n = v === "static" ? "static" : "dynamic", r = S ? { hashFn: S } : void 0, i = n === "static" ? ne(e, r) : te(e, r);
495
- if (v === "per-route" && i.usedHashes.size > 0 && k.set(t, i.usedHashes), !i.needsCatalogImport) return;
496
- let a = v === "per-route" ? "per-route" : n;
512
+ let { splitting: n, config: r } = f();
513
+ if (!n || !g(h(this)) || t.includes("node_modules") || !t.match(/\.(vue|tsx|jsx|ts|js)(\?|$)/)) return;
514
+ let i = n === "static" ? "static" : "dynamic", a = r.idGenerator ? { hashFn: r.idGenerator } : void 0, o = i === "static" ? te(e, a) : ee(e, a);
515
+ if (n === "per-route" && o.usedHashes.size > 0 && x.set(t, o.usedHashes), !o.needsCatalogImport) return;
516
+ let s = n === "per-route" ? "per-route" : i;
497
517
  return {
498
- code: ue(i.code, a, i.usedHashes, S),
518
+ code: V(o.code, s, o.usedHashes, r.idGenerator),
499
519
  map: null
500
520
  };
501
521
  },
502
522
  generateBundle(e, t) {
503
- if (v !== "per-route" || k.size === 0) return;
504
- let n = /* @__PURE__ */ new Map();
505
- for (let [e, r] of Object.entries(t)) {
506
- if (r.type !== "chunk") continue;
523
+ let { splitting: n, localeCodes: r, catalogDir: a } = f();
524
+ if (n !== "per-route" || x.size === 0) return;
525
+ let o = /* @__PURE__ */ new Map();
526
+ for (let [e, n] of Object.entries(t)) {
527
+ if (n.type !== "chunk") continue;
507
528
  let t = /* @__PURE__ */ new Set();
508
- for (let e of Object.keys(r.modules)) {
509
- let n = k.get(e);
529
+ for (let e of Object.keys(n.modules)) {
530
+ let n = x.get(e);
510
531
  if (n) for (let e of n) t.add(e);
511
532
  }
512
- t.size > 0 && n.set(e, t);
533
+ t.size > 0 && o.set(e, t);
513
534
  }
514
- if (n.size === 0) return;
515
- let r = /* @__PURE__ */ new Map();
516
- for (let [e, t] of n) for (let n of t) {
517
- let t = r.get(n) ?? [];
518
- t.push(e), r.set(n, t);
535
+ if (o.size === 0) return;
536
+ let s = /* @__PURE__ */ new Map();
537
+ for (let [e, t] of o) for (let n of t) {
538
+ let t = s.get(n) ?? [];
539
+ t.push(e), s.set(n, t);
519
540
  }
520
- let a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
521
- for (let [e, t] of r) if (t.length > 1) a.add(e);
541
+ let c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Map();
542
+ for (let [e, t] of s) if (t.length > 1) c.add(e);
522
543
  else {
523
- let n = X(t[0]), r = o.get(n) ?? /* @__PURE__ */ new Set();
524
- r.add(e), o.set(n, r);
544
+ let n = X(t[0]), r = u.get(n) ?? /* @__PURE__ */ new Set();
545
+ r.add(e), u.set(n, r);
525
546
  }
526
- let s = i(T, d);
527
- for (let e of b) {
528
- let t = ve(s, e);
529
- if (!t) continue;
547
+ let d = i(l, a);
548
+ for (let e of r) {
549
+ let t = ve(d, e);
550
+ if (!t) {
551
+ this.warn(`[fluenti] per-route splitting: compiled catalog for locale "${e}" not found in ${d} — skipping chunk generation`);
552
+ continue;
553
+ }
530
554
  let n = _e(t);
531
- if (a.size > 0) {
532
- let t = Z(a, n);
555
+ if (c.size > 0) {
556
+ let t = Z(c, n);
533
557
  this.emitFile({
534
558
  type: "asset",
535
559
  fileName: `_fluenti/shared-${e}.js`,
536
560
  source: t
537
561
  });
538
562
  }
539
- for (let [t, r] of o) {
563
+ for (let [t, r] of u) {
540
564
  let i = Z(r, n);
541
565
  this.emitFile({
542
566
  type: "asset",
@@ -546,47 +570,50 @@ function Se(t, r, a) {
546
570
  }
547
571
  }
548
572
  }
549
- }, j = u.buildAutoCompile ?? !0, M = {
573
+ }, C = {
550
574
  name: "fluenti:build-compile",
551
575
  async buildStart() {
552
- !g(h(this)) || !j || C && await C() === !1 || (await _({
553
- cwd: T,
576
+ let { config: e } = f();
577
+ g(h(this)) && (e.buildAutoCompile ?? !0) && (e.onBeforeCompile && await e.onBeforeCompile() === !1 || (await _({
578
+ cwd: l,
554
579
  throwOnError: !0,
555
580
  compileOnly: !0
556
- }), w && await w());
581
+ }), e.onAfterCompile && await e.onAfterCompile()));
557
582
  }
558
- }, N = u.devAutoCompile ?? !0, P = {
583
+ }, w = {
559
584
  name: "fluenti:dev",
560
585
  configureServer(t) {
561
- if (!N) return;
562
- let n = l(t.config.root), r = e(n.include ?? ["src/**/*.{vue,tsx,jsx,ts,js}"], [
586
+ let { config: n, catalogDir: r } = f(t.config.root);
587
+ if (!(n.devAutoCompile ?? !0)) return;
588
+ let i = e(n.include ?? ["src/**/*.{vue,tsx,jsx,ts,js}"], [
563
589
  ...n.exclude ?? [],
564
590
  "**/node_modules/**",
565
- `**/${d}/**`
566
- ]), i = {
591
+ `**/${r}/**`
592
+ ]), a = {
567
593
  cwd: t.config.root,
568
594
  onSuccess: () => {}
569
595
  };
570
- u.parallelCompile && (i.parallelCompile = !0), C && (i.onBeforeCompile = C), w && (i.onAfterCompile = w);
571
- let a = ee(i, u.devAutoCompileDelay ?? 500);
572
- a(), t.watcher.on("change", (e) => {
573
- r(e) && a();
596
+ n.parallelCompile && (a.parallelCompile = !0), n.onBeforeCompile && (a.onBeforeCompile = n.onBeforeCompile), n.onAfterCompile && (a.onAfterCompile = n.onAfterCompile);
597
+ let o = v(a, n.devAutoCompileDelay ?? 500);
598
+ o(), t.watcher.on("change", (e) => {
599
+ i(e) && o();
574
600
  });
575
601
  },
576
602
  hotUpdate({ file: e }) {
577
- if (e.includes(d)) {
603
+ let { catalogDir: t } = f();
604
+ if (e.includes(t)) {
578
605
  let e = [...this.environment.moduleGraph.urlToModuleMap.entries()].filter(([e]) => e.includes("virtual:fluenti")).map(([, e]) => e);
579
606
  if (e.length > 0) return e;
580
607
  }
581
608
  }
582
609
  };
583
610
  return [
584
- E,
611
+ p,
585
612
  ...r,
586
- O,
587
- M,
588
- A,
589
- P
613
+ b,
614
+ C,
615
+ S,
616
+ w
590
617
  ];
591
618
  }
592
619
  //#endregion