@animus-ui/vite-plugin 0.1.36 → 0.1.38
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/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/context.d.ts +8 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/index-html.d.ts.map +1 -1
- package/dist/index.cjs +50 -14
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/virtual-modules.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/constants.d.ts
CHANGED
|
@@ -16,5 +16,9 @@ export declare const RESOLVED_BRIDGE_ID = "\0virtual:animus/hmr-bridge.js";
|
|
|
16
16
|
export declare const BRIDGE_SCRIPT_SRC = "/@id/virtual:animus/hmr-bridge.js";
|
|
17
17
|
export declare const VIRTUAL_SYSTEM_PROPS_ID = "virtual:animus/system-props";
|
|
18
18
|
export declare const RESOLVED_SYSTEM_PROPS_ID = "\0virtual:animus/system-props";
|
|
19
|
+
/** The faces this build preloads, with the URL each file is preloaded at:
|
|
20
|
+
* the module every host serves under this id. */
|
|
21
|
+
export declare const VIRTUAL_FONT_PRELOADS_ID = "virtual:animus/font-preloads";
|
|
22
|
+
export declare const RESOLVED_FONT_PRELOADS_ID = "\0virtual:animus/font-preloads";
|
|
19
23
|
export { DEFAULT_EXCLUDE } from '@animus-ui/extract/pipeline';
|
|
20
24
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,cAAc,8BAAgC,CAAC;AAC5D,eAAO,MAAM,eAAe,gCAAwB,CAAC;AAErD,eAAO,MAAM,qBAAqB,iCAAmC,CAAC;AACtE,eAAO,MAAM,sBAAsB,mCAA+B,CAAC;AAEnE,eAAO,MAAM,iBAAiB,iCAAmC,CAAC;AAClE,eAAO,MAAM,kBAAkB,mCAA2B,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,sCAA8B,CAAC;AAE7D,eAAO,MAAM,uBAAuB,gCAAkC,CAAC;AACvE,eAAO,MAAM,wBAAwB,kCAAiC,CAAC;AAEvE;kDACkD;AAClD,eAAO,MAAM,wBAAwB,iCAA0B,CAAC;AAChE,eAAO,MAAM,yBAAyB,mCAAkC,CAAC;AAIzE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC"}
|
package/dist/context.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { EnvironmentBuilds, ExtractionSession } from '@animus-ui/extract/session
|
|
|
2
2
|
import { HotUpdateEvents } from './hot-update-events';
|
|
3
3
|
import type { LightningTargets } from './css';
|
|
4
4
|
import type { AnimusExtractOptions } from './index';
|
|
5
|
-
import type { ExcludeMatcher, ExternalPackageOutcome, HostAssetClassification, HostExtensionPolicy, HostLoadExpander, ProjectManifest, SystemConfig } from '@animus-ui/extract/pipeline';
|
|
5
|
+
import type { ExcludeMatcher, ExternalPackageOutcome, FontPreload, HostAssetClassification, HostExtensionPolicy, HostLoadExpander, ProjectManifest, SystemConfig } from '@animus-ui/extract/pipeline';
|
|
6
6
|
import type { SessionOutcome, SessionPublication, WatchChanges } from '@animus-ui/extract/session';
|
|
7
7
|
import type { Logger } from 'vite';
|
|
8
8
|
/** A Session outcome, and whether its publication changed the served
|
|
@@ -73,6 +73,10 @@ export declare class PluginContext {
|
|
|
73
73
|
* without re-analysis. */
|
|
74
74
|
get globalCss(): string;
|
|
75
75
|
get resolvedComponentCss(): string;
|
|
76
|
+
/** The published font preloads, each by the URL the stylesheet's own
|
|
77
|
+
* `url()` gets: what index.html preloads and the font-preloads module
|
|
78
|
+
* exports. */
|
|
79
|
+
get fontPreloads(): FontPreload[];
|
|
76
80
|
private analysisSheets;
|
|
77
81
|
private substitutedSheets;
|
|
78
82
|
layerDeclaration: string;
|
|
@@ -179,6 +183,9 @@ export declare class PluginContext {
|
|
|
179
183
|
/** A root-relative URL a face names as written, as Vite's dev CSS pass
|
|
180
184
|
* writes it: under `server.origin` and the base where it names a public
|
|
181
185
|
* file or a file under the root, else unchanged. */
|
|
186
|
+
/** Whether `href` is a root-relative URL of a file Vite serves, from its
|
|
187
|
+
* public directory or its root. */
|
|
188
|
+
servesRootRelative(href: string): boolean;
|
|
182
189
|
devRootRelativeUrl(href: string): string;
|
|
183
190
|
/** A dev asset() URL: an immutable content-named copy of `absPath`, so an
|
|
184
191
|
* edit gets a new URL, or the live file where copies are not served. */
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAgBA,OAAO,EAGL,iBAAiB,EAGjB,iBAAiB,EAGlB,MAAM,4BAA4B,CAAC;AAYpC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,EAEV,cAAc,EACd,sBAAsB,EACtB,WAAW,EACX,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACb,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAEV,cAAc,EACd,kBAAkB,EAClB,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAgBnC;2BAC2B;AAC3B,M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ACrE,0BAA0B,IAAI,IAAI,CAcjC;IAED,aAAa,IAAI,IAAI,CA2BpB;CACF"}
|
package/dist/index-html.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-html.d.ts","sourceRoot":"","sources":["../src/index-html.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index-html.d.ts","sourceRoot":"","sources":["../src/index-html.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AA0C9C;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAeV;AAsED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,iBAAiB,EAAE,GACxB,MAAM,GAAG,iBAAiB,EAAE,CAU9B;AA0BD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,aAAa,EAClB,IAAI,SAAK,GACR,iBAAiB,EAAE,CAuCrB"}
|
package/dist/index.cjs
CHANGED
|
@@ -246,6 +246,10 @@ const RESOLVED_BRIDGE_ID = `\0${VIRTUAL_BRIDGE_ID}`;
|
|
|
246
246
|
const BRIDGE_SCRIPT_SRC = `/@id/${VIRTUAL_BRIDGE_ID}`;
|
|
247
247
|
const VIRTUAL_SYSTEM_PROPS_ID = `${VIRTUAL_PREFIX}system-props`;
|
|
248
248
|
const RESOLVED_SYSTEM_PROPS_ID = `\0${VIRTUAL_SYSTEM_PROPS_ID}`;
|
|
249
|
+
/** The faces this build preloads, with the URL each file is preloaded at:
|
|
250
|
+
* the module every host serves under this id. */
|
|
251
|
+
const VIRTUAL_FONT_PRELOADS_ID = _animus_ui_extract_session.FONT_PRELOADS_MODULE_ID;
|
|
252
|
+
const RESOLVED_FONT_PRELOADS_ID = `\0${VIRTUAL_FONT_PRELOADS_ID}`;
|
|
249
253
|
//#endregion
|
|
250
254
|
//#region src/hot-update-events.ts
|
|
251
255
|
/**
|
|
@@ -419,6 +423,15 @@ var PluginContext = class {
|
|
|
419
423
|
get resolvedComponentCss() {
|
|
420
424
|
return this.substitutedSheets().componentCss;
|
|
421
425
|
}
|
|
426
|
+
/** The published font preloads, each by the URL the stylesheet's own
|
|
427
|
+
* `url()` gets: what index.html preloads and the font-preloads module
|
|
428
|
+
* exports. */
|
|
429
|
+
get fontPreloads() {
|
|
430
|
+
return (0, _animus_ui_extract_pipeline.substituteFontPreloads)(this.served?.fontPreloads, this.assetUrlBySpecifier).map((preload) => this.isProd ? preload : {
|
|
431
|
+
...preload,
|
|
432
|
+
href: this.devRootRelativeUrl(preload.href)
|
|
433
|
+
});
|
|
434
|
+
}
|
|
422
435
|
analysisSheets() {
|
|
423
436
|
return {
|
|
424
437
|
...NO_SHEETS,
|
|
@@ -676,15 +689,20 @@ var PluginContext = class {
|
|
|
676
689
|
/** A root-relative URL a face names as written, as Vite's dev CSS pass
|
|
677
690
|
* writes it: under `server.origin` and the base where it names a public
|
|
678
691
|
* file or a file under the root, else unchanged. */
|
|
679
|
-
|
|
680
|
-
|
|
692
|
+
/** Whether `href` is a root-relative URL of a file Vite serves, from its
|
|
693
|
+
* public directory or its root. */
|
|
694
|
+
servesRootRelative(href) {
|
|
695
|
+
if (!href.startsWith("/") || href.startsWith("//")) return false;
|
|
681
696
|
let path$6;
|
|
682
697
|
try {
|
|
683
698
|
path$6 = decodeURI(href.split(/[?#]/)[0]);
|
|
684
699
|
} catch {
|
|
685
|
-
return
|
|
700
|
+
return false;
|
|
686
701
|
}
|
|
687
|
-
|
|
702
|
+
return [this.publicDir, this.viteRoot].some((dir) => dir !== "" && (0, fs.existsSync)((0, path.join)(dir, path$6)));
|
|
703
|
+
}
|
|
704
|
+
devRootRelativeUrl(href) {
|
|
705
|
+
if (!this.servesRootRelative(href)) return href;
|
|
688
706
|
const base = this.base.endsWith("/") ? this.base.slice(0, -1) : this.base;
|
|
689
707
|
return `${this.serverOrigin}${base}${href}`;
|
|
690
708
|
}
|
|
@@ -778,7 +796,8 @@ var PluginContext = class {
|
|
|
778
796
|
for (const moduleId of [
|
|
779
797
|
RESOLVED_CSS_ID,
|
|
780
798
|
RESOLVED_COMPONENTS_ID,
|
|
781
|
-
RESOLVED_SYSTEM_PROPS_ID
|
|
799
|
+
RESOLVED_SYSTEM_PROPS_ID,
|
|
800
|
+
RESOLVED_FONT_PRELOADS_ID
|
|
782
801
|
]) {
|
|
783
802
|
const mod = server.moduleGraph.getModuleById(moduleId);
|
|
784
803
|
if (mod) server.moduleGraph.invalidateModule(mod);
|
|
@@ -1429,17 +1448,12 @@ function injectHeadTags(html, tags) {
|
|
|
1429
1448
|
const inserted = tags.map((tag) => `\n${indent}${serializeTag(tag)}`).join("");
|
|
1430
1449
|
return html.slice(0, offset) + inserted + html.slice(offset);
|
|
1431
1450
|
}
|
|
1432
|
-
/** The preloads for the faces that ask for one,
|
|
1433
|
-
*
|
|
1434
|
-
* preloads is left out. */
|
|
1451
|
+
/** The preloads for the faces that ask for one, each marked as Animus's;
|
|
1452
|
+
* one the document already preloads is left out. */
|
|
1435
1453
|
function fontPreloadTags(ctx, html) {
|
|
1436
|
-
|
|
1437
|
-
if (published.length === 0) return [];
|
|
1454
|
+
if (!ctx.served?.fontPreloads.length) return [];
|
|
1438
1455
|
const existing = preloadedHrefs(html);
|
|
1439
|
-
return (
|
|
1440
|
-
...preload,
|
|
1441
|
-
href: ctx.devRootRelativeUrl(preload.href)
|
|
1442
|
-
}).filter(({ href }) => !existing.has(href)).map(({ href, type }) => {
|
|
1456
|
+
return ctx.fontPreloads.filter(({ href }) => !existing.has(href)).map(({ href, type }) => {
|
|
1443
1457
|
const attrs = {
|
|
1444
1458
|
rel: "preload",
|
|
1445
1459
|
href,
|
|
@@ -1527,6 +1541,7 @@ function resolveVirtualId(ctx, id) {
|
|
|
1527
1541
|
if (id === VIRTUAL_COMPONENTS_ID) return RESOLVED_COMPONENTS_ID;
|
|
1528
1542
|
if (id === VIRTUAL_BRIDGE_ID) return RESOLVED_BRIDGE_ID;
|
|
1529
1543
|
if (id === VIRTUAL_SYSTEM_PROPS_ID) return RESOLVED_SYSTEM_PROPS_ID;
|
|
1544
|
+
if (id === VIRTUAL_FONT_PRELOADS_ID) return RESOLVED_FONT_PRELOADS_ID;
|
|
1530
1545
|
const srcEntry = ctx.externalSourceEntries.get(id);
|
|
1531
1546
|
if (srcEntry) {
|
|
1532
1547
|
const moduleSideEffects = ctx.externalSourceSideEffects.get(id);
|
|
@@ -1624,8 +1639,29 @@ if (import.meta.hot) {
|
|
|
1624
1639
|
`;
|
|
1625
1640
|
}
|
|
1626
1641
|
if (id === RESOLVED_SYSTEM_PROPS_ID) return ctx.systemPropsModule;
|
|
1642
|
+
if (id === RESOLVED_FONT_PRELOADS_ID) return fontPreloadsSource(ctx);
|
|
1627
1643
|
return null;
|
|
1628
1644
|
}
|
|
1645
|
+
/**
|
|
1646
|
+
* The font-preloads module: each preload at the href index.html preloads it.
|
|
1647
|
+
* A build's asset placeholder becomes the emitted file's URL here as it does
|
|
1648
|
+
* in the page. A build imports a root-relative file Vite serves with `?url`,
|
|
1649
|
+
* so Vite applies its `base` here as it does to the page's preload. Not
|
|
1650
|
+
* `fontPreloadsModule`, which reads a `./` href against the module.
|
|
1651
|
+
*/
|
|
1652
|
+
function fontPreloadsSource(ctx) {
|
|
1653
|
+
const imports = [];
|
|
1654
|
+
const entries = ctx.fontPreloads.map(({ href, ...rest }) => {
|
|
1655
|
+
if (!ctx.isProd || !ctx.servesRootRelative(href) || /[?#]/.test(href)) return JSON.stringify({
|
|
1656
|
+
href,
|
|
1657
|
+
...rest
|
|
1658
|
+
});
|
|
1659
|
+
const name = `href${imports.length}`;
|
|
1660
|
+
imports.push(`import ${name} from ${JSON.stringify(`${href}?url`)};\n`);
|
|
1661
|
+
return `{ href: ${name}, ...${JSON.stringify(rest)} }`;
|
|
1662
|
+
});
|
|
1663
|
+
return `${imports.join("")}export default [${entries.join(", ")}];\n`;
|
|
1664
|
+
}
|
|
1629
1665
|
//#endregion
|
|
1630
1666
|
//#region src/watch-ignored.ts
|
|
1631
1667
|
/** A path as a glob that matches only itself. Each special character
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ import type { AnimusQuarantineOptions, ClosedDynamicImport, FontPreloadEntry, Di
|
|
|
2
2
|
import type { Plugin } from 'vite';
|
|
3
3
|
export { discoverFiles } from '@animus-ui/extract/pipeline';
|
|
4
4
|
export type { AnimusQuarantineOptions } from '@animus-ui/extract/pipeline';
|
|
5
|
+
/** The entries `virtual:animus/font-preloads` exports by default: each file
|
|
6
|
+
* this build preloads, the URL it is preloaded at, and its faces. */
|
|
7
|
+
export type { FontPreload, PreloadedFontFace, } from '@animus-ui/extract/pipeline';
|
|
5
8
|
export interface AnimusExtractOptions {
|
|
6
9
|
/** Path to a module exporting a SystemInstance from `@animus-ui/system`. */
|
|
7
10
|
system: string;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EACV,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAEhB,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,MAAM,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,YAAY,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AA+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EACV,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAEhB,eAAe,EAChB,MAAM,6BAA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5B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC;IACd;;;OAGG;IACH,mBAAmB,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,uBAAuB,CAAC;CACtC;AAiBD,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CA4MnE;eAEc,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-modules.d.ts","sourceRoot":"","sources":["../src/virtual-modules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"virtual-modules.d.ts","sourceRoot":"","sources":["../src/virtual-modules.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAa/C,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,aAAa,EAClB,EAAE,EAAE,MAAM,GACT,MAAM,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAoB5D;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,aAAa,EAClB,EAAE,EAAE,MAAM,GACT,MAAM,GAAG,IAAI,CAkHf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@animus-ui/vite-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
4
4
|
"description": "Animus static CSS extraction Vite plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"animus",
|
|
@@ -39,16 +39,16 @@
|
|
|
39
39
|
"compile": "bun check"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@animus-ui/extract": "0.1.
|
|
42
|
+
"@animus-ui/extract": "0.1.38",
|
|
43
43
|
"browserslist": "^4.28.8",
|
|
44
44
|
"lightningcss": "^1.33.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@animus-ui/assertions": "0.1.
|
|
48
|
-
"@animus-ui/layergate": "0.1.
|
|
47
|
+
"@animus-ui/assertions": "0.1.38",
|
|
48
|
+
"@animus-ui/layergate": "0.1.38"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@animus-ui/layergate": "0.1.
|
|
51
|
+
"@animus-ui/layergate": "0.1.38",
|
|
52
52
|
"vite": ">=8 <9"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|