@animus-ui/vite-plugin 0.1.47 → 0.1.48

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.
Files changed (2) hide show
  1. package/dist/index.cjs +27 -27
  2. package/package.json +5 -5
package/dist/index.cjs CHANGED
@@ -192,7 +192,7 @@ function applyResolvedConfig(ctx, config) {
192
192
  const copyDir = (0, path.resolve)(config.cacheDir, "animus-assets", processCopyDir());
193
193
  const served = (0, vite.isFileLoadingAllowed)(config, (0, path.join)(copyDir, "asset"));
194
194
  ctx.assetCopyDir = served ? copyDir : null;
195
- ctx.servesFile = (path$11) => (0, vite.isFileLoadingAllowed)(config, path$11);
195
+ ctx.servesFile = (path) => (0, vite.isFileLoadingAllowed)(config, path);
196
196
  if (!served) ctx.warn(`[animus-extract] asset() copies in ${copyDir} are not served under server.fs; serving the live files instead, so an edited asset keeps its URL`);
197
197
  }
198
198
  ctx.outputExcludes = (0, _animus_ui_extract_pipeline.outputExclusions)(config.root, (0, _animus_ui_extract_pipeline.viteOutputTargets)(config));
@@ -612,7 +612,7 @@ var PluginContext = class {
612
612
  * between sees one generation. */
613
613
  observeOutcome(session, outcome) {
614
614
  let systemPropsChanged = false;
615
- if (outcome.kind === "held") for (const [path$7, hash] of outcome.abortedOriginals) this.abortedParseHashes.set(path$7, hash);
615
+ if (outcome.kind === "held") for (const [path, hash] of outcome.abortedOriginals) this.abortedParseHashes.set(path, hash);
616
616
  else {
617
617
  this.abortedParseHashes.clear();
618
618
  const before = this.systemPropsModule;
@@ -711,8 +711,8 @@ var PluginContext = class {
711
711
  devServedUrl(absPath) {
712
712
  const base = this.base.endsWith("/") ? this.base.slice(0, -1) : this.base;
713
713
  const root = this.viteRoot.endsWith("/") ? this.viteRoot : `${this.viteRoot}/`;
714
- const path$8 = this.viteRoot !== "" && absPath.startsWith(root) ? `/${absPath.slice(root.length)}` : `/@fs${absPath}`;
715
- return `${this.serverOrigin}${base}${path$8}`;
714
+ const path = this.viteRoot !== "" && absPath.startsWith(root) ? `/${absPath.slice(root.length)}` : `/@fs${absPath}`;
715
+ return `${this.serverOrigin}${base}${path}`;
716
716
  }
717
717
  /** A root-relative URL a face names as written, as Vite's dev CSS pass
718
718
  * writes it: under `server.origin` and the base where it names a public
@@ -721,13 +721,13 @@ var PluginContext = class {
721
721
  * public directory or its root. */
722
722
  servesRootRelative(href) {
723
723
  if (!href.startsWith("/") || href.startsWith("//")) return false;
724
- let path$6;
724
+ let path$2;
725
725
  try {
726
- path$6 = decodeURI(href.split(/[?#]/)[0]);
726
+ path$2 = decodeURI(href.split(/[?#]/)[0]);
727
727
  } catch {
728
728
  return false;
729
729
  }
730
- return [this.publicDir, this.viteRoot].some((dir) => dir !== "" && (0, fs.existsSync)((0, path.join)(dir, path$6)));
730
+ return [this.publicDir, this.viteRoot].some((dir) => dir !== "" && (0, fs.existsSync)((0, path.join)(dir, path$2)));
731
731
  }
732
732
  devRootRelativeUrl(href) {
733
733
  if (!this.servesRootRelative(href)) return href;
@@ -859,8 +859,8 @@ var PluginContext = class {
859
859
  plan.missing,
860
860
  directories
861
861
  ]) {
862
- const added = paths.filter((path$9) => !registered.has(path$9));
863
- for (const path$10 of added) registered.add(path$10);
862
+ const added = paths.filter((path) => !registered.has(path));
863
+ for (const path of added) registered.add(path);
864
864
  if (added.length > 0) watcher.add(added);
865
865
  }
866
866
  }
@@ -964,13 +964,13 @@ function parentOnDisk(ctx, input) {
964
964
  actual: (0, path.relative)(ctx.rootDir, probed.actual)
965
965
  }, "spell the import as the file is spelled.")}`
966
966
  };
967
- const path$5 = probed.path;
968
- const relPath = (0, path.relative)(ctx.rootDir, path$5);
969
- const excludedBy = ctx.excludeMatcher.explain(path$5, relPath);
970
- const reason = excludedBy ? `which is excluded by pattern '${excludedBy}'. Include that file in the extraction sources or remove this extension.` : !(0, _animus_ui_extract_pipeline.isPathWithinRoot)(ctx.rootDir, path$5) ? "outside the extraction root. Declare its package in the system includes or move it under the project root." : !ctx.extensionsSet.has((0, path.extname)(path$5)) ? `whose extension is not in the configured source extensions.` : (0, path.extname)(path$5) === ".mdx" || ctx.session?.heldSources.has(relPath) ? null : void 0;
967
+ const path$1 = probed.path;
968
+ const relPath = (0, path.relative)(ctx.rootDir, path$1);
969
+ const excludedBy = ctx.excludeMatcher.explain(path$1, relPath);
970
+ const reason = excludedBy ? `which is excluded by pattern '${excludedBy}'. Include that file in the extraction sources or remove this extension.` : !(0, _animus_ui_extract_pipeline.isPathWithinRoot)(ctx.rootDir, path$1) ? "outside the extraction root. Declare its package in the system includes or move it under the project root." : !ctx.extensionsSet.has((0, path.extname)(path$1)) ? `whose extension is not in the configured source extensions.` : (0, path.extname)(path$1) === ".mdx" || ctx.session?.heldSources.has(relPath) ? null : void 0;
971
971
  if (reason === void 0) return {
972
972
  kind: "fold",
973
- path: path$5
973
+ path: path$1
974
974
  };
975
975
  if (reason === null) return { kind: "none" };
976
976
  return {
@@ -1075,7 +1075,7 @@ function applyDevBridgeImport(code) {
1075
1075
  function extendingFiles(ctx, analysisPaths) {
1076
1076
  const manifest = ctx.storedManifest;
1077
1077
  const files = /* @__PURE__ */ new Set();
1078
- const queue = analysisPaths.flatMap((path$3) => manifest?.files[path$3] ?? []);
1078
+ const queue = analysisPaths.flatMap((path) => manifest?.files[path] ?? []);
1079
1079
  const seen = new Set(queue);
1080
1080
  while (queue.length > 0) {
1081
1081
  const id = queue.shift();
@@ -1118,7 +1118,7 @@ async function transformSource(ctx, code, requestId) {
1118
1118
  if (mergePublished(outcomes).published) {
1119
1119
  const merged = mergePublished([...outcomes, ...await reconcileSourceCorpus(ctx)]);
1120
1120
  applyPublished(ctx, merged);
1121
- if (!merged.full) invalidateFileModules(ctx, [...merged.planChanged].filter((path$4) => path$4 !== relativePath));
1121
+ if (!merged.full) invalidateFileModules(ctx, [...merged.planChanged].filter((path) => path !== relativePath));
1122
1122
  const compCount = ctx.storedManifest?.files[relativePath]?.length ?? 0;
1123
1123
  ctx.info(`New file detected: ${relativePath} — ${compCount ? `${compCount} components extracted` : "no components"}`);
1124
1124
  ctx.invalidateExtractedModules();
@@ -1229,7 +1229,7 @@ async function reloadSystem(ctx, events) {
1229
1229
  const reloadStart = performance.now();
1230
1230
  const modifiedFiles = /* @__PURE__ */ new Set();
1231
1231
  const removedFiles = /* @__PURE__ */ new Set();
1232
- for (const [path$1, type] of events) (type === "delete" ? removedFiles : modifiedFiles).add(path$1);
1232
+ for (const [path, type] of events) (type === "delete" ? removedFiles : modifiedFiles).add(path);
1233
1233
  let outcomes;
1234
1234
  try {
1235
1235
  outcomes = await ctx.submitChanges({
@@ -1298,7 +1298,7 @@ async function analyzeChangedFile(ctx, file, absFile, read) {
1298
1298
  const staleDefinitionFiles = [.../* @__PURE__ */ new Set([
1299
1299
  ...merged.planChanged,
1300
1300
  ...merged.redeliver,
1301
- ...extendingFiles(ctx, redelivered.flatMap((path$2) => published.ownership[path$2]?.analysisPaths ?? [path$2]))
1301
+ ...extendingFiles(ctx, redelivered.flatMap((path) => published.ownership[path]?.analysisPaths ?? [path]))
1302
1302
  ])].filter((defFile) => (0, path.resolve)(ctx.rootDir, defFile) !== absFile);
1303
1303
  ctx.log(`HMR update: ${relPath} — total ${Math.round(performance.now() - hmrStart)}ms${presentationOnly ? " (presentation-only)" : ""}`);
1304
1304
  return {
@@ -1652,11 +1652,11 @@ function sheetRegistryHash(ctx) {
1652
1652
  return (0, crypto.createHash)("md5").update((0, _animus_ui_extract_pipeline.stableStringify)(ctx.options)).digest("hex").slice(0, 8);
1653
1653
  }
1654
1654
  function resolveVirtualId(ctx, id) {
1655
- if (id === VIRTUAL_CSS_ID) return RESOLVED_CSS_ID;
1655
+ if (id === "virtual:animus/styles.css") return RESOLVED_CSS_ID;
1656
1656
  if (id.startsWith("virtual:animus/") && RESOLVED_SLICE_IDS.has(`\0${id}`)) return `\0${id}`;
1657
- if (id === VIRTUAL_COMPONENTS_ID) return RESOLVED_COMPONENTS_ID;
1658
- if (id === VIRTUAL_BRIDGE_ID) return RESOLVED_BRIDGE_ID;
1659
- if (id === VIRTUAL_SYSTEM_PROPS_ID) return RESOLVED_SYSTEM_PROPS_ID;
1657
+ if (id === "virtual:animus/components.js") return RESOLVED_COMPONENTS_ID;
1658
+ if (id === "virtual:animus/hmr-bridge.js") return RESOLVED_BRIDGE_ID;
1659
+ if (id === "virtual:animus/system-props") return RESOLVED_SYSTEM_PROPS_ID;
1660
1660
  if (id === VIRTUAL_FONT_PRELOADS_ID) return RESOLVED_FONT_PRELOADS_ID;
1661
1661
  const srcEntry = ctx.externalSourceEntries.get(id);
1662
1662
  if (srcEntry) {
@@ -1706,15 +1706,15 @@ function stylesheetSource(ctx) {
1706
1706
  return checked(ctx, [variables, processedBody].filter(Boolean).join("\n"));
1707
1707
  }
1708
1708
  function loadVirtualModule(ctx, id) {
1709
- if (id === RESOLVED_CSS_ID) return ctx.splitsStylesheet ? SPLIT_STYLESHEET_MARKER : stylesheetSource(ctx);
1710
- if (id === RESOLVED_COMPONENTS_ID) {
1709
+ if (id === "\0virtual:animus/styles.css") return ctx.splitsStylesheet ? SPLIT_STYLESHEET_MARKER : stylesheetSource(ctx);
1710
+ if (id === "\0virtual:animus/components.js") {
1711
1711
  const strippedCss = (0, _animus_ui_extract_pipeline.stripLeadingLayerDeclaration)(ctx.resolvedComponentCss || "");
1712
1712
  return `export default \`${checked(ctx, (0, _animus_ui_extract_pipeline.postProcessCss)(strippedCss, {
1713
1713
  ...lightningOptions(ctx),
1714
1714
  minify: false
1715
1715
  })).replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$")}\`;`;
1716
1716
  }
1717
- if (id === RESOLVED_BRIDGE_ID) {
1717
+ if (id === "\0virtual:animus/hmr-bridge.js") {
1718
1718
  const sheetHash = sheetRegistryHash(ctx);
1719
1719
  return `
1720
1720
  import css from '${VIRTUAL_COMPONENTS_ID}';
@@ -1756,7 +1756,7 @@ if (import.meta.hot) {
1756
1756
  }
1757
1757
  `;
1758
1758
  }
1759
- if (id === RESOLVED_SYSTEM_PROPS_ID) return ctx.systemPropsModule;
1759
+ if (id === "\0virtual:animus/system-props") return ctx.systemPropsModule;
1760
1760
  if (id === RESOLVED_FONT_PRELOADS_ID) return fontPreloadsSource(ctx);
1761
1761
  return null;
1762
1762
  }
@@ -1947,7 +1947,7 @@ function animusExtract(options) {
1947
1947
  const slice = RESOLVED_SLICE_IDS.get(id);
1948
1948
  if (slice !== void 0) return slices.get(slice) ?? "";
1949
1949
  const own = loadVirtualModule(ctx, id);
1950
- if (id === RESOLVED_CSS_ID && own !== null && !ctx.splitsStylesheet) return withVendorHead(this, own);
1950
+ if (id === "\0virtual:animus/styles.css" && own !== null && !ctx.splitsStylesheet) return withVendorHead(this, own);
1951
1951
  return own;
1952
1952
  },
1953
1953
  async transform(code, id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@animus-ui/vite-plugin",
3
- "version": "0.1.47",
3
+ "version": "0.1.48",
4
4
  "description": "Animus static CSS extraction Vite plugin",
5
5
  "keywords": [
6
6
  "animus",
@@ -43,16 +43,16 @@
43
43
  "compile": "bun check"
44
44
  },
45
45
  "dependencies": {
46
- "@animus-ui/extract": "0.1.47",
46
+ "@animus-ui/extract": "0.1.48",
47
47
  "browserslist": "^4.28.8",
48
48
  "lightningcss": "^1.33.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@animus-ui/assertions": "0.1.47",
52
- "@animus-ui/layergate": "0.1.47"
51
+ "@animus-ui/assertions": "0.1.48",
52
+ "@animus-ui/layergate": "0.1.48"
53
53
  },
54
54
  "peerDependencies": {
55
- "@animus-ui/layergate": "0.1.47",
55
+ "@animus-ui/layergate": "0.1.48",
56
56
  "vite": ">=8 <9"
57
57
  },
58
58
  "peerDependenciesMeta": {