@animus-ui/vite-plugin 0.1.0-next.40 → 0.1.0-next.44

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 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAI3C,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,qGAAqG;IACrG,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AA6ID,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CA4+BnE;AAED,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAI3C,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,qGAAqG;IACrG,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AA6ID,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CA0hCnE;AAED,eAAe,aAAa,CAAC"}
package/dist/index.mjs CHANGED
@@ -140,6 +140,7 @@ function animusExtract(options) {
140
140
  let packageMap = {};
141
141
  let externalPackageDirs = [];
142
142
  const externalSourceEntries = /* @__PURE__ */ new Map();
143
+ let devServer;
143
144
  let bridgeInjected = false;
144
145
  let resolvedSystemPath = null;
145
146
  /**
@@ -287,6 +288,9 @@ function animusExtract(options) {
287
288
  return {
288
289
  name: "animus-extract",
289
290
  enforce: "pre",
291
+ configureServer(server) {
292
+ devServer = server;
293
+ },
290
294
  configResolved(config) {
291
295
  isProd = config.command === "build";
292
296
  rootDir = config.root;
@@ -506,7 +510,28 @@ if (import.meta.hot) {
506
510
  if (id.includes("node_modules")) return null;
507
511
  }
508
512
  const relativePath = relative(rootDir, id);
509
- if (!storedManifest.files?.[relativePath]?.length) return null;
513
+ if (!storedManifest.files?.[relativePath]?.length) {
514
+ if (!isProd && !fileCache.has(relativePath)) {
515
+ const hash = contentHash(code);
516
+ fileCache.set(relativePath, {
517
+ hash,
518
+ source: code
519
+ });
520
+ runAnalysis(buildFileEntriesFromCache(fileCache, relativePath));
521
+ const compCount = storedManifest.files?.[relativePath]?.length ?? 0;
522
+ log(`New file detected: ${relativePath} — ${compCount ? `${compCount} components extracted` : "no components"}`);
523
+ if (compCount && devServer) {
524
+ const compModule = devServer.moduleGraph.getModuleById(RESOLVED_COMPONENTS_ID);
525
+ if (compModule) devServer.moduleGraph.invalidateModule(compModule);
526
+ const sysPropModule = devServer.moduleGraph.getModuleById(RESOLVED_SYSTEM_PROPS_ID);
527
+ if (sysPropModule) devServer.moduleGraph.invalidateModule(sysPropModule);
528
+ setTimeout(() => {
529
+ devServer.hot.send({ type: "full-reload" });
530
+ }, 100);
531
+ }
532
+ }
533
+ if (!storedManifest.files?.[relativePath]?.length) return null;
534
+ }
510
535
  try {
511
536
  const { transformFile } = __require("@animus-ui/extract");
512
537
  const result = transformFile(code, relativePath, storedManifestJson);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@animus-ui/vite-plugin",
3
- "version": "0.1.0-next.40",
3
+ "version": "0.1.0-next.44",
4
4
  "description": "Animus static CSS extraction Vite plugin",
5
5
  "author": "codecaaron <airrobb@gmail.com>",
6
6
  "license": "MIT",
@@ -37,8 +37,8 @@
37
37
  "vite": ">=5.0.0"
38
38
  },
39
39
  "dependencies": {
40
- "@animus-ui/extract": "0.1.0-next.40",
41
- "@animus-ui/system": "0.1.0-next.40",
40
+ "@animus-ui/extract": "0.1.0-next.44",
41
+ "@animus-ui/system": "0.1.0-next.44",
42
42
  "browserslist": "^4.24.0",
43
43
  "lightningcss": "^1.29.0"
44
44
  }