next-font 1.2.0 → 1.2.2-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.
Files changed (83) hide show
  1. package/LICENSE +1 -1
  2. package/dist/declaration-DT93DSPn.d.mts +16 -0
  3. package/dist/entireMetricsCollection-B27p4vNx.mjs +1 -0
  4. package/dist/font-data-DAoQ4nTq.mjs +1 -0
  5. package/dist/fontkit-DZqVarF0.mjs +3 -0
  6. package/dist/google/index.d.mts +19164 -0
  7. package/dist/google/index.mjs +1 -0
  8. package/dist/local.d.mts +24 -0
  9. package/dist/local.mjs +1 -0
  10. package/dist/manifest.d.mts +14 -0
  11. package/dist/manifest.mjs +1 -0
  12. package/dist/rolldown-EavF8sBr.mjs +80 -0
  13. package/dist/rolldown.d.mts +6 -0
  14. package/dist/rolldown.mjs +1 -0
  15. package/dist/vite.d.mts +6 -0
  16. package/dist/vite.mjs +1 -0
  17. package/package.json +44 -44
  18. package/README.md +0 -51
  19. package/dist/cc-D_YwSRId.js +0 -1
  20. package/dist/constants.d.ts +0 -3
  21. package/dist/constants.js +0 -1
  22. package/dist/fontkit.d.ts +0 -2
  23. package/dist/fontkit.js +0 -1
  24. package/dist/format-available-values.d.ts +0 -7
  25. package/dist/format-available-values.js +0 -1
  26. package/dist/google/cc-BnfmUjCg.mjs +0 -1
  27. package/dist/google/fetch-css-from-google-fonts.d.ts +0 -10
  28. package/dist/google/fetch-css-from-google-fonts.js +0 -2
  29. package/dist/google/fetch-font-file.d.ts +0 -7
  30. package/dist/google/fetch-font-file.js +0 -1
  31. package/dist/google/fetch-resource.d.ts +0 -8
  32. package/dist/google/fetch-resource.js +0 -1
  33. package/dist/google/find-font-files-in-css.d.ts +0 -11
  34. package/dist/google/find-font-files-in-css.js +0 -1
  35. package/dist/google/get-fallback-font-override-metrics.d.ts +0 -16
  36. package/dist/google/get-fallback-font-override-metrics.js +0 -1
  37. package/dist/google/get-font-axes.d.ts +0 -10
  38. package/dist/google/get-font-axes.js +0 -3
  39. package/dist/google/get-google-fonts-url.d.ts +0 -10
  40. package/dist/google/get-google-fonts-url.js +0 -1
  41. package/dist/google/get-proxy-agent.d.ts +0 -8
  42. package/dist/google/get-proxy-agent.js +0 -4
  43. package/dist/google/google-fonts-metadata.d.ts +0 -16
  44. package/dist/google/google-fonts-metadata.js +0 -1
  45. package/dist/google/index.d.ts +0 -18414
  46. package/dist/google/index.js +0 -1
  47. package/dist/google/loader.d.ts +0 -40
  48. package/dist/google/loader.js +0 -9
  49. package/dist/google/retry.d.ts +0 -5
  50. package/dist/google/retry.js +0 -3
  51. package/dist/google/sort-fonts-variant-values.d.ts +0 -7
  52. package/dist/google/sort-fonts-variant-values.js +0 -1
  53. package/dist/google/validate-google-font-function-call.d.ts +0 -18
  54. package/dist/google/validate-google-font-function-call.js +0 -9
  55. package/dist/index.d.ts +0 -38
  56. package/dist/index.js +0 -1
  57. package/dist/local/fontkit-DX1wsFnK.js +0 -1
  58. package/dist/local/get-fallback-metrics-from-font-file.d.ts +0 -21
  59. package/dist/local/get-fallback-metrics-from-font-file.js +0 -1
  60. package/dist/local/index.d.ts +0 -23
  61. package/dist/local/index.js +0 -1
  62. package/dist/local/loader.d.ts +0 -40
  63. package/dist/local/loader.js +0 -5
  64. package/dist/local/pick-font-file-for-fallback-generation.d.ts +0 -15
  65. package/dist/local/pick-font-file-for-fallback-generation.js +0 -2
  66. package/dist/local/validate-local-font-function-call.d.ts +0 -26
  67. package/dist/local/validate-local-font-function-call.js +0 -2
  68. package/dist/next-font-error.d.ts +0 -6
  69. package/dist/next-font-error.js +0 -1
  70. package/dist/types.d.ts +0 -15
  71. package/dist/types.js +0 -1
  72. package/google/index.d.ts +0 -1
  73. package/google/index.js +0 -15
  74. package/google/loader.d.ts +0 -1
  75. package/google/loader.js +0 -1
  76. package/google/target.css +0 -1
  77. package/local/index.d.ts +0 -1
  78. package/local/index.js +0 -15
  79. package/local/loader.d.ts +0 -1
  80. package/local/loader.js +0 -1
  81. package/local/target.css +0 -1
  82. package/manifest/index.d.ts +0 -36
  83. package/manifest/index.js +0 -1
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1,24 @@
1
+ import { i as NextFontWithVariable, n as Display, r as NextFont, t as CssVariable } from "./declaration-DT93DSPn.mjs";
2
+
3
+ //#region src/local.d.ts
4
+ type LocalFont<T extends CssVariable | undefined = undefined> = {
5
+ src: string | Array<{
6
+ path: string;
7
+ weight?: string;
8
+ style?: string;
9
+ }>;
10
+ display?: Display;
11
+ weight?: string;
12
+ style?: string;
13
+ adjustFontFallback?: "Arial" | "Times New Roman" | false;
14
+ fallback?: string[];
15
+ preload?: boolean;
16
+ variable?: T;
17
+ declarations?: Array<{
18
+ prop: string;
19
+ value: string;
20
+ }>;
21
+ };
22
+ declare function localFont<T extends CssVariable | undefined = undefined>(options: LocalFont<T>): T extends undefined ? NextFont : NextFontWithVariable;
23
+ //#endregion
24
+ export { localFont as default };
package/dist/local.mjs ADDED
@@ -0,0 +1 @@
1
+ function e(e){throw Error()}export{e as default};
@@ -0,0 +1,14 @@
1
+ //#region src/manifest.d.ts
2
+ /**
3
+ * Get hrefs for fonts to preload
4
+ * Returns null if there are no fonts at all.
5
+ * Returns string[] if there are fonts to preload (font paths)
6
+ * Returns empty string[] if there are fonts but none to preload and no other fonts have been preloaded
7
+ * Returns null if there are fonts but none to preload and at least some were previously preloaded
8
+ */
9
+ declare function getPreloadableFonts(filePath?: string): string[] | null;
10
+ declare const def: {
11
+ getPreloadableFonts: typeof getPreloadableFonts;
12
+ };
13
+ //#endregion
14
+ export { def as default, getPreloadableFonts };
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1,80 @@
1
+ import{xxh3 as e}from"@node-rs/xxhash";import t from"node:fs/promises";import n from"node:path";import{parse as r}from"oxc-parser";import{print as i}from"esrap";import a from"esrap/languages/ts";import o from"esrap/languages/tsx";const s=e=>{let t=new URLSearchParams(e),n=[];for(let[e,r]of t.entries())n.push(e,r);let r=n.join(``),i=14695981039346656037n;for(let e=0;e<r.length;e++)i^=BigInt(r.charCodeAt(e)),i*=1099511628211n;return Number(i&4294967295n)},c=(e,t)=>e===`webFont`?t:`${t} Fallback`,l=(e,t)=>`${e.toLowerCase().replace(/ /g,`_`)}_${t.toString(16)}`,u=/[?#].*$/;function d(e){return e.replace(u,``)}function f(e){return Array.isArray(e)?e:[e]}const p=[`auto`,`block`,`swap`,`fallback`,`optional`],m=(e,t)=>{if(e.arguments.length>1)throw Error(`Only zero or one arguments to font functions are currently supported`);let n=e.arguments[0]??{},r=e.import.replace(`_`,` `),i=t.get(r);if(!i)throw Error(`Unknown font`);let a=new Set(f(n.weight??[])),o=f(n.style??[]),s=i.weights.some(e=>e===`variable`),c=(()=>{if(a.size===0||a.has(`variable`)){if(a.size===0&&!s)throw Error(`Missing weight for ${r}. Available weights: ${i.weights.join(`, `)}`);if(a.has(`variable`)&&a.size>1)throw Error(`Unexpected \`variable\` in weight array for font \`${r}\`. You only need \`variable\`, it includes all available weights.`);return{type:`variable`}}else{for(let e of a)if(!i.weights.includes(e))throw Error(`Unexpected weight \`${e}\` for font \`${r}\`. Available weights: ${i.weights.join(`, `)}`);return{type:`fixed`,values:Array.from(a).map(e=>parseInt(e,10))}}})();o.length===0&&(i.styles.length===1?o.push(i.styles[0]):o.push(`normal`));for(let e of o)if(!i.styles.includes(e))throw Error(`Unexpected style \`${e}\` for font \`${r}\`. Available styles: ${i.styles.join(`, `)}`);let l=n.display??`swap`;if(!p.includes(l))throw Error(`Invalid display value ${l} for font ${r}.\nAvailable display values: ${p.join(`, `)}`);if(n.axes!=null&&n.axes.length>0){if(!s)throw Error(`Axes can only be defined for variable fonts.`);if(c.type!==`variable`)throw Error("Axes can only be defined for variable fonts when the weight property is nonexistent or set to `variable`.")}return{fontFamily:r,weights:c,styles:o,display:l,preload:n.preload??!0,selectedVariableAxes:n.axes,fallback:n.fallback,adjustFontFallback:n.adjustFontFallback??!0,variable:n.variable,subsets:n.subsets}},h={name:`Arial`,capsizeKey:`arial`,azAvgWidth:934.5116279069767,unitsPerEm:2048},g={name:`Times New Roman`,capsizeKey:`timesNewRoman`,azAvgWidth:854.3953488372093,unitsPerEm:2048},_=e=>e.type===`automatic`&&e.value.adjustment!==void 0;var v=class{constructor(e){this.fallbacks=e}hasSizeAdjust=()=>this.fallbacks.some(_)},y=class t{chunks=[];static SEED=BigInt(0);constructor(){}writeBytes(e){this.chunks.push(e)}finish(){let n=ne(this.chunks);return e.xxh64(n,t.SEED)}writeValue(e){e.deterministicHash(this)}writeRef(e){e.deterministicHash(this)}};function ee(e){let t=new y;return e.deterministicHash(t),t.finish()}var te=class e{static encoder=new TextEncoder;constructor(e){this.value=e}deterministicHash(t){t.writeBytes(e.encoder.encode(this.value))}};function ne(e){if(e.length===0)return new Uint8Array;if(e.length===1)return e[0];let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}const b=e=>{let t;return()=>(t||=e().then(e=>(t=e,e)),t)};function re(e){let t=e.lastIndexOf(`.`),[n,r]=t===-1?[null,null]:[e.slice(0,t),e.slice(t+1)];return n!=null&&r!=null?r?.includes(`/`)||n.endsWith(`/`)||n?.length===0?[e,null]:[n,r]:[e,null]}const ie=/[\u0000-\u001F"#$%&*+,:;<=>?[\]^`{|}\u007F]/g,ae=/^[a-z]:/i;function oe(e){let t=ae.exec(e),n=t?t[0]:``;return n+e.slice(n.length).replace(ie,`_`)}const x=e=>`[next]_${e}`,S=(e,t,n,r,i)=>{let a=e[t];if(!a)throw Error(`Font family not found`);let o=new Set;if(r.includes(`normal`)&&o.add(`normal`),r.includes(`italic`)&&o.add(`italic`),n.type===`variable`){let e=a.axes;if(!e)throw Error(`Font ${t} has no definable \`axes\``);if(i){let n=e.map(e=>e.tag);for(let e of i)if(!n.includes(e))throw Error(`Invalid axes value ${e} for font ${t}. Available axes: ${n.join(`, `)}`)}let n,r=[];for(let t of e)t.tag===`wght`?n=`${t.min}..${t.max}`:i?.includes(t.tag)&&r.push([t.tag,`${t.min}..${t.max}`]);return{wght:{type:`variable`,range:n},ital:o,variableAxes:r.length?r:void 0}}return{wght:{type:`fixed`,values:n.values.slice().sort((e,t)=>e-t)},ital:o}},C=(e,t,n,r)=>{let i=[],a=[];if(n.wght.type===`variable`&&n.wght.range?a=[n.wght.range]:n.wght.type===`fixed`&&(a=n.wght.values),!a.length&&n.variableAxes!=null&&n.variableAxes.length>0)i.push(n.variableAxes);else for(let e of a)if(n.ital.size===0)i.push([[`wght`,e]].concat(n.variableAxes?.map(([e,t])=>[e,t])??[]));else for(let t of n.ital)i.push([t===`italic`||n.ital.size>1?[`ital`,t===`normal`?`0`:`1`]:[],[`wght`,e]].concat(n.variableAxes??[]));for(let e=0;e<i.length;e++)i[e]=i[e].sort((e,t)=>{let n=e[0].charCodeAt(0)>96,r=t[0].charCodeAt(0)>96;return n&&!r?-1:r&&!n?1:e[0].localeCompare(t[0])});let o=i[0];if(!o)return`${e}?family=${t.replace(/ /g,`+`)}&display=${r}`;let s=o.map(([e])=>e).join(`,`),c=i.map(e=>e.map(e=>e[1])).toSorted((e,t)=>{for(let n=0;n<Math.min(e.length,e.length);n++){let r=e[n],i=t[n],a=typeof r==typeof i?r<i?-1:r>i?1:0:typeof r==`string`?-1:1;if(a!==0)return a}return e.length-t.length}).map(e=>e.map(e=>e.toString()).join(`,`)).join(`;`);return`${e}?family=${t.replace(/ /g,`+`)}:${s}@${c}&display=${r}`},w=e=>(e*100).toFixed(2),T=async e=>{let t=``;for(let n of e.fallbacks)if(n.type===`automatic`){let{scopedFontFamily:e,localFontFamily:r,adjustment:i}=n.value,a=i?`
2
+ ascent-override: ${w(i.ascent)}%;
3
+ descent-override: ${w(Math.abs(i.descent))}%;
4
+ line-gap-override: ${w(i.lineGap)}%;
5
+ size-adjust: ${w(i.sizeAdjust)}%;
6
+ `:``;t+=`
7
+ @font-face {
8
+ font-family: '${e}';
9
+ src: local("${r}");
10
+ ${a}
11
+ }
12
+ `}return t},E=async e=>{let t=e.fontFamily,n=`
13
+ .className {
14
+ font-family: ${t};
15
+ ${e.weight?`font-weight: ${e.weight};\n`:``}${e.style?`font-style: ${e.style};\n`:``}
16
+ }
17
+ `;return e.variable&&(n+=`
18
+ .variable {
19
+ ${e.variable}: ${t};
20
+ }
21
+ `),n},se=async(e,t,n)=>{let r=e??``;return r+=await T(new v([n])),r+=await E(t),r},ce={name:`Times New Roman`,capsizeKey:`timesNewRoman`},le={name:`Arial`,capsizeKey:`arial`},ue=e=>e.replace(/\b\w/g,(e,t)=>t===0?e.toLowerCase():e.toUpperCase()).replace(/\s+/g,``),de=(e,t,n)=>{let r=t[ue(e)];if(!r)throw Error(`Font not found in metrics`);let i=r.category===`serif`?ce:le,a;if(n){let e=r.xWidthAvg/r.unitsPerEm,n=t[i.capsizeKey];if(!n)throw Error(`Fallback font metrics missing: ${i.name}`);let o=e/(n.xWidthAvg/n.unitsPerEm);a={ascent:r.ascent/(r.unitsPerEm*o),descent:(r.descent??0)/(r.unitsPerEm*o),lineGap:r.lineGap/(r.unitsPerEm*o),sizeAdjust:o}}return{fontFamily:i.name,adjustment:a}},fe=b(async()=>import(`./entireMetricsCollection-B27p4vNx.mjs`).then(e=>e.entireMetricsCollection)),D=async e=>{if(e.fallback)return{type:`manual`,value:e.fallback};let t=await fe();try{let n=de(e.fontFamily,t,e.adjustFontFallback);return{type:`automatic`,value:{scopedFontFamily:c(`fallback`,e.fontFamily),localFontFamily:n.fontFamily,adjustment:n.adjustment}}}catch{return console.error(`Failed to find font override values for font ${e.fontFamily}. Skipping generating a fallback font.`),{type:`error`}}};function pe(){return async function(e){let t=d(e),n=t===e?``:e.slice(t.length+1);if(!n)return null;let r=s(n),i=new URLSearchParams(`${n.startsWith(`?`)?``:`?`}${n}`),a=A(n,await O()),o=k(a,await D(a));return{path:`\0${x(`internal/font/google`)}/${l(a.fontFamily,r)}.js`,content:`import cssModule from "@vercel/turbopack-next/internal/font/google/cssmodule.module.css?${i.toString()}";
22
+ const fontData = {
23
+ className: cssModule.className,
24
+ style: {
25
+ fontFamily: "${o.fontFamily}",
26
+ ${o.weight?`fontWeight: ${o.weight}, `:``}${o.style?`fontStyle: "${o.style}",`:``}
27
+ },
28
+ };
29
+
30
+ if (cssModule.variable != null) {
31
+ fontData.variable = cssModule.variable;
32
+ }
33
+
34
+ export default fontData;`}}}function me(e){return async function(t){let n=d(t),r=n===t?``:t.slice(n.length+1);if(!r)return null;let i=s(r),a=await O(),o=A(r,a),u=ve(o,a),f=c(`webFont`,o.fontFamily),p=`${x(`internal/font/google`)}/${l(o.fontFamily,i)}.module.css`,m=process.env.NEXT_FONT_GOOGLE_MOCKED_RESPONSES,h=await(m?N(u,m):j(u,p)),g=new Map,v=await D(o),y=h==null?(()=>{if(this.build)throw Error(`Failed to fetch \`${o.fontFamily}\`from Google Fonts.`);return console.error(`Failed to download \`${o.fontFamily}\` from Google Fonts. Using fallback`),null})():await ge.bind(this)(g,h,o,f,_(v));for(let[t,n]of g)e.set(t,n);return{path:p,content:se(y??null,k(o,v),v),deps:Array.from(g.keys())}}}async function he({url:e,preload:t,hasSizeAdjust:n},r){let[i,a]=re(e);if(!a)throw Error(`Font url \`${e}\` is missing an extension`);let o=`${ee(new te(i)).toString(16).padStart(16,`0`)}${n?`-s`:``}${t?`.p`:``}`,s=`${x(`internal/font/google`)}/${o}.${a}`;return{path:s,content:r.has(s)?null:M.bind({})(e,s).then(e=>e?.bytes())}}const O=b(async()=>import(`./font-data-DAoQ4nTq.mjs`).then(e=>e.default));async function ge(e,t,n,r,i){let a=t.replace(`font-family: '${n.fontFamily}';`,`font-family: '${r}';`),o=_e(a,n.preload?n.subsets??[]:[]);return await Promise.all(o.map(async({fontUrl:t,preload:n})=>{let r=await he({url:t,preload:n,hasSizeAdjust:i},e),o=await r.content,s=o!=null&&this.build?this.getFileName(this.emitFile({type:`asset`,name:r.path,source:o})):r.path;o!=null&&e.set(s,o),a=a.replace(t,`/${s}`)})),a}const _e=(e,t)=>{let n=[],r=``,i=/\/\* (.+?) \*\//,a=/src: url\((.+?)\)/;for(let o of e.split(`
35
+ `)){let e=o.match(i)?.[1];if(e){r=e;continue}let s=o.match(a)?.[1];s!=null&&(n.some(e=>e.fontUrl===s)||n.push({fontUrl:s,preload:t.includes(r)}))}return n};function ve(e,t){return C(process.env.TURBOPACK_TEST_ONLY_MOCK_SERVER??`https://fonts.googleapis.com/css2`,e.fontFamily,S(t,e.fontFamily,e.weights,e.styles,e.selectedVariableAxes),e.display)}function k(e,t){let n=[`'${c(`webFont`,e.fontFamily)}'`];switch(t.type){case`manual`:n.push(...t.value);break;case`automatic`:n.push(`'${t.value.scopedFontFamily}'`);break;case`error`:break}return{fontFamily:n.join(`, `),weight:e.weights.type===`variable`||e.weights.values.length>1||e.weights.values[0]==null?void 0:String(e.weights.values[0]),style:e.styles.length>1?void 0:e.styles[0],variable:e.variable}}function A(e,t){let n=new URLSearchParams(`${e.startsWith(`?`)?``:`?`}${e}`);if(n.size!==1)throw Error(`"next-font/google queries must have exactly one entry"`);let r=n.entries().next().value[0];return m(JSON.parse(r),new Map(Object.entries(t)))}async function j(e,t){try{return await M.bind({})(e,t).then(e=>e?.text())??null}catch(e){return console.warn(`Failed to fetch stylesheet for ${t}:`,e),null}}async function M(e,t){try{return fetch(e,{headers:{"User-Agent":`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36`},cache:`force-cache`})}catch(e){return(this.warn??console.warn)(`Google Fonts fetch warning at ${t}: ${String(e)}`),null}}async function N(e,r){let i=n.resolve(r),a;try{let e=await t.readFile(i,`utf-8`);a=JSON.parse(e)}catch(e){throw Error(`Failed to read mocked responses at ${i}: ${String(e)}`)}if(!(e in a))throw Error(`Mocked response for URL "${e}" not found`);return a[e]??null}const P=[`next/font`,`@next/font`,`next-font`],F=P.flatMap(e=>[`${e}/google`,`${e}/local`]);var ye=class{kind;args;constructor(...e){if(e.length===0)throw Error("`And` expects at least one operand");this.args=e,this.kind=`and`}},be=class{kind;args;constructor(...e){if(e.length===0)throw Error("`Or` expects at least one operand");this.args=e,this.kind=`or`}},xe=class{kind;expr;constructor(e){this.expr=e,this.kind=`not`}},Se=class{kind;pattern;params;constructor(e,t){this.pattern=e,this.kind=`id`,this.params=t??{cleanUrl:!1}}},Ce=class{kind;pattern;constructor(e){this.pattern=e,this.kind=`moduleType`}},we=class{kind;expr;constructor(e){this.expr=e,this.kind=`include`}};function Te(...e){return new ye(...e)}function Ee(...e){return new be(...e)}function De(e){return new xe(e)}function Oe(e,t){return new Se(e,t)}function I(e){return new Ce(e)}function ke(e){return new we(e)}function L(e,t){return RegExp(`^${je(e)}`,t)}const Ae=/[-/\\^$*+?.()|[\]{}]/g;function je(e){return e.replace(Ae,`\\$&`)}function Me({fontFileMap:e=new Map,virtualSources:t=new Map,entryFileToFontFiles:n=new Map}={}){let r=pe(),i=me(e),a=P.map(e=>`${e}/google/target.css`),o=new Map,s=new Map;return[{name:`next-font-google:replacer`,resolveId:{order:`pre`,filter:{id:a.map(e=>L(`${e}?`))},async handler(e,n){let i=await r(e);return i?(t.set(i.path,i.content),n&&(o.set(n,(o.get(n)??new Set).add(i.path)),s.set(i.path,(s.get(i.path)??new Set).add(n))),i.path):null}}},{name:`next-font-google:css-module-replacer`,resolveId:{order:`pre`,filter:{id:L(`@vercel/turbopack-next/internal/font/google/cssmodule.module.css?`)},async handler(e,r){let a=`environment`in this&&this.environment!=null&&typeof this.environment==`object`&&`mode`in this.environment&&typeof this.environment.mode==`string`?this.environment.mode===`build`:!this.meta.watchMode,o=await i.bind({build:a,emitFile:this.emitFile.bind(this),getFileName:this.getFileName.bind(this)})(e);if(!o)return null;if(t.set(o.path,o.content),r){let e=s.get(r);if(e)for(let t of e){let e=n.get(t)??new Set;for(let t of o.deps)e.add(t);n.set(t,e)}}return o.path}}}]}var Ne=class{constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:()=>this.should_skip=!0,remove:()=>this.should_remove=!0,replace:e=>this.replacement=e}}replace(e,t,n,r){e&&t&&(n==null?e[t]=r:e[t][n]=r)}remove(e,t,n){e&&t&&(n==null?delete e[t]:e[t].splice(n,1))}},Pe=class extends Ne{constructor(e,t){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:()=>this.should_skip=!0,remove:()=>this.should_remove=!0,replace:e=>this.replacement=e},this.enter=e,this.leave=t}visit(e,t,n,r){if(e){if(this.enter){let i=this.should_skip,a=this.should_remove,o=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,e,t,n,r),this.replacement&&(e=this.replacement,this.replace(t,n,r,e)),this.should_remove&&this.remove(t,n,r);let s=this.should_skip,c=this.should_remove;if(this.should_skip=i,this.should_remove=a,this.replacement=o,s)return e;if(c)return null}let i;for(i in e){let t=e[i];if(t&&typeof t==`object`)if(Array.isArray(t)){let n=t;for(let t=0;t<n.length;t+=1){let r=n[t];R(r)&&(this.visit(r,e,i,t)||t--)}}else R(t)&&this.visit(t,e,i,null)}if(this.leave){let i=this.replacement,a=this.should_remove;this.replacement=null,this.should_remove=!1,this.leave.call(this.context,e,t,n,r),this.replacement&&(e=this.replacement,this.replace(t,n,r,e)),this.should_remove&&this.remove(t,n,r);let o=this.should_remove;if(this.replacement=i,this.should_remove=a,o)return null}}return e}};function R(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}function z(e,{enter:t,leave:n}){return new Pe(t,n).visit(e,null)}const Fe=(e,t,n)=>{z(e,{enter(e){if(e.type!==`ImportDeclaration`)return;let r=e.source.value;if(t.includes(r)){n.removableModuleItems.add(e);for(let t of e.specifiers){if(t.type===`ImportNamespaceSpecifier`)throw Error(`Font loaders can't have namespace imports`);let e=t.local.name,i;t.type===`ImportSpecifier`&&(i=t.imported.type===`Identifier`?t.imported.name:void 0),n.fontFunctionsInAllowedScope.add(t.local),n.fontFunctions.set(e,{loader:r,functionName:i})}}}})},B=new WeakMap;let Ie=0;function V(e){let t=typeof e,n=e&&e.constructor,r=n===Date;if(Object(e)===e&&!r&&n!=RegExp){let t=B.get(e);if(t)return t;t=++Ie+`~`,B.set(e,t);let r;if(n===Array){for(t=`@`,r=0;r<e.length;r++)t+=V(e[r])+`,`;B.set(e,t)}else if(n===Object){t=`#`;let n=Object.keys(e).sort();for(;(r=n.pop())!==void 0;)e[r]!==void 0&&(t+=r+`:`+V(e[r])+`,`);B.set(e,t)}return t}return r?e.toJSON():t===`symbol`?e.toString():t===`string`?JSON.stringify(e):``+e}const Le=(e,t)=>{z(e,{enter(e){if(e.type===`Identifier`&&t.fontFunctions.has(e.name)&&!Array.from(t.fontFunctionsInAllowedScope).map(V).some(t=>t===V(e)))throw Error(`Font loaders must be called and assigned to a const in the module scope`)}})};var Re=class{state;relativePath;constructor(e,t){this.state=e,this.relativePath=t}checkCallExpr(e,t){if(e.callee.type!==`Identifier`)return null;let n=e.callee.name,r=this.state.fontFunctions.get(n);if(!r)return null;this.state.fontFunctionsInAllowedScope.add(e.callee);let i=e.arguments.map(e=>{if(e.type===`SpreadElement`)throw Error(`Font loaders don't accept spreads`);return H(e)}),a=r.functionName??``,o={path:this.relativePath,import:a,arguments:i,variableName:t?.name};return{type:`ImportDeclaration`,specifiers:[],attributes:[],source:{type:`Literal`,value:`${r.loader}/target.css?${JSON.stringify(o)}`,raw:`'${r.loader}/target.css?${JSON.stringify(o)}'`}}}checkVarDecl(e){let t=e.declarations[0];if(!t||!t.id||!t.init)return null;let n;if(t.id.type===`Identifier`)n=t.id;else return null;if(t.init.type!==`CallExpression`)return null;let r=this.checkCallExpr(t.init,n);if(!r)return null;if(e.kind!==`const`)throw Error(`Font loader calls must be assigned to a const`);return r.specifiers=[{type:`ImportDefaultSpecifier`,local:n}],this.state.fontImports.push(r),n}visitModule(e){z(e,{enter:(e,t)=>{if(e.type===`VariableDeclaration`){if(t&&t.type===`ExportNamedDeclaration`)return;this.checkVarDecl(e)&&this.state.removableModuleItems.add(e)}if(e.type===`ExportNamedDeclaration`&&e.declaration?.type===`VariableDeclaration`){let t=this.checkVarDecl(e.declaration);t&&(this.state.removableModuleItems.add(e),this.state.fontExports.push({type:`ExportNamedDeclaration`,declaration:null,specifiers:[{type:`ExportSpecifier`,local:t,exported:t}],source:null}))}}})}};function ze(e,t,n){new Re(n,t).visitModule(e)}const H=e=>{switch(e.type){case`Literal`:return e.value;case`ObjectExpression`:return Be(e);case`ArrayExpression`:return e.elements.map(e=>{if(e){if(e.type===`SpreadElement`)throw Error(`Unexpected spread`);return H(e)}else throw Error(`Unexpected empty value in array`)});default:throw Error(`Font loader values must be explicitly written literals.`)}},Be=e=>{let t={};for(let n of e.properties){if(n.type===`SpreadElement`)throw Error(`Unexpected spread`);if(n.kind!==`init`)throw Error(`Unexpected key`);if(n.key.type!==`Identifier`)throw Error(`Unexpected object key type`);t[n.key.name]=H(n.value)}return t},Ve=()=>({fontFunctions:new Map,removableModuleItems:new Set,fontImports:[],fontExports:[],fontFunctionsInAllowedScope:new Set}),He=e=>t=>{let n=Ve();if(Fe(t,e.fontLoaders,n),n.removableModuleItems.size===0)return null;ze(t,e.relativeFilePathFromRoot,n),Le(t,n);let r=t.body.findIndex(e=>n.removableModuleItems.has(e));return t.body=t.body.filter(e=>!n.removableModuleItems.has(e)),r>=0&&t.body.splice(r,0,...n.fontImports),t.body.push(...n.fontExports),{fontImports:n.fontImports.map(e=>e.specifiers[0]?.local.name).filter(Boolean)}},Ue=({fontLoaders:e})=>({name:`next-font-transform`,transform:{filter:[ke(Ee(I(`js`),I(`jsx`),Te(I(`ts`),De(Oe(/\.d\.ts$/))),I(`jsx`),I(`mjs`),I(`cjs`)))],async handler(t,s,c){let l=typeof c==`object`&&`ast`in c&&c.ast!=null?structuredClone(c.ast):(await r(s,t)).program;return He({fontLoaders:e,relativeFilePathFromRoot:n.relative(process.cwd(),s)})(l)?i(l,s.endsWith(`x`)?o():a()):null}}}),U=e=>{let t=e.trim().split(/\s+/);return t.length===2?{type:`variable`,start:t[0],end:t[1]}:{type:`fixed`,value:e}},W=e=>{let t=e.path.split(`.`);if(t.length<2)throw Error(`Extension required`);return{path:e.path,weight:e.weight?U(e.weight):void 0,style:e.style,ext:t.pop()}},We=e=>{let t=e.arguments[0];return{fonts:typeof t.src==`string`?W({path:t.src,weight:t.weight,style:t.style}):t.src.map(W),display:t.display??`swap`,preload:t.preload??!0,fallback:t.fallback,adjustFontFallback:t.adjustFontFallback??`Arial`,variable:t.variable,variableName:e.variableName,defaultWeight:t.weight?U(t.weight):void 0,defaultStyle:t.style,declarations:t.declarations?t.declarations.map(e=>({prop:e.prop,value:e.value})):void 0}};var G=class{constructor(e){this.field0=e}toString(){return`Font file not found: Can't resolve ${this.field0}`}};function Ge({variableName:e},t){let n=[`'${c(`webFont`,e)}'`];for(let e of t.fallbacks)e.type===`automatic`?n.push(`'${e.value.scopedFontFamily}'`):e.type===`manual`&&n.push(...e.value);return n.join(`, `)}async function Ke(e,t,n,r){return[await qe(c(`webFont`,e.variableName),e,r),await T(t),await E(n)].join(`
36
+ `)}async function qe(e,t,r){let i=``,a=f(t.fonts);for(let o of a){let a=t.declarations?.some(e=>e.prop===`font-family`)??!1,s=t.declarations?t.declarations.map(e=>`${e.prop}: ${e.value};`).join(`
37
+ `):``,c=a?``:`\n font-family: '${e}';`,l=o.weight??t.defaultWeight,u=l?`\n font-weight: ${l.type===`variable`?`${l.start} ${l.end}`:l.value};`:``,d=o.style??t.defaultStyle,f=d?`\n font-style: ${d};`:``;i+=`@font-face {
38
+ ${s}${c}
39
+ src: url('${n.join(r.replace(/^\0/,``),o.path)}') format('${Je(o.ext)}');
40
+ font-display: ${t.display};
41
+ ${u}${f}
42
+ }\n`}return i}function Je(e){switch(e){case`woff`:return`woff`;case`woff2`:return`woff2`;case`ttf`:return`truetype`;case`otf`:return`opentype`;case`eot`:return`embedded-opentype`;default:throw Error(`Unknown font file extension`)}}const K=b(()=>import(`./fontkit-DZqVarF0.mjs`).then(e=>e.default));async function q(e,t){let n=c(`fallback`,t.variableName),r=[],i=t.adjustFontFallback===`Arial`||t.adjustFontFallback===`Times New Roman`?await Ye(e,t,t.adjustFontFallback===`Arial`?h:g):null;return i instanceof G?i:(i!=null&&r.push({type:`automatic`,value:{scopedFontFamily:n,localFontFamily:t.adjustFontFallback===`Arial`?`Arial`:`Times New Roman`,adjustment:i}}),t.fallback!=null&&r.push({type:`manual`,value:t.fallback}),new v(r))}async function Ye(e,r,i){let a=Xe(r.fonts),o=await t.readFile(n.join(e,a.path)).catch(()=>null);if(!o)return new G(a.path);let s=await K(),c=await(async()=>{let e=s(Buffer.from(o.buffer));return`fonts`in e?e.fonts[0]:e})().catch(()=>null);if(!c)throw Error(`"Unable to read font metrics from font file at ${a.path}"`);let l=Qe(c),{unitsPerEm:u}=c,d=i.azAvgWidth/i.unitsPerEm,f=l?l/d:1;return{ascent:c.ascent/(u*f),descent:c.descent/(u*f),lineGap:c.lineGap/(u*f),sizeAdjust:f}}function Xe(e){if(!Array.isArray(e))return e;let t=e.values(),n=t.next().value;if(!n)throw Error(`At least one font is required`);for(let e of t){let t=J(n.weight),r=J(e.weight);if(t===r&&e.style!==`italic`){n=e;continue}let i=Math.abs(t),a=Math.abs(r);if(a<i){n=e;continue}if(a===i&&r<t){n=e;continue}}return n}function J(e){return e?e.type===`fixed`?Y(e.value)-400:(()=>{let t=Y(e.start),n=Y(e.end);if(400>t&&400<n)return 0;let r=t-400,i=n-400;return Math.abs(r)<Math.abs(i)?r:i})():0}function Y(e){if(e===`normal`)return 400;if(e===`bold`)return 700;{let t=Number(e);if(Number.isNaN(t))throw Error(`Invalid weight value in src array: \`${e}\`. Expected \`normal\`, \`bold\` or a number.`);return t}}const X={a:.0668,b:.0122,c:.0228,d:.0348,e:.1039,f:.0182,g:.0165,h:.0499,i:.057,j:.0013,k:.0063,l:.0329,m:.0197,n:.0552,o:.0614,p:.0158,q:8e-4,r:.049,s:.0518,t:.0741,u:.0226,v:.008,w:.0193,x:.0012,y:.0162,z:6e-4," ":.1818},Z=Object.keys(X).join(``),Ze=e=>{if(!Object.keys(X).includes(e))throw Error(`No weighting specified for character: “${e}”`);return X[e]};function Qe(e){let{familyName:t}=e,n=e.glyphsForString(Z).reduce((n,r,i)=>{let a=Z.charAt(i),o=e[`OS/2`].xAvgCharWidth;try{o=r.advanceWidth}catch{console.warn(`Couldn’t read 'advanceWidth' for character “${a===` `?`<space>`:a}” from “${t}”. Falling back to “xAvgCharWidth”.`)}return n+o*Ze(a)},0);return Math.round(n)}const $e=({virtualSources:e=new Map}={})=>({name:`next-font-local:resolve`,resolveId:{order:`pre`,filter:{id:[L(`@vercel/turbopack-next/internal/font/local/`)].concat(P.map(e=>L(`${e}/local/`)))},async handler(t,r){if(!r)return null;let i=n.dirname(r),a=d(t),o=a===t?``:t.slice(a.length+1);if(!o)return null;if(P.map(e=>`${e}/local/target.css`).includes(a)){let t=s(o),n=$(o),r=await q(i,n);r instanceof G&&this.error(`Font file not found: Can't resolve '${r.field0}'`);let a=Q(n,r),c=`import cssModule from "@vercel/turbopack-next/internal/font/local/cssmodule.module.css?${new URLSearchParams(`${o.startsWith(`?`)?``:`?`}${o}`).toString()}";
43
+ const fontData = {
44
+ className: cssModule.className,
45
+ style: {
46
+ fontFamily: "${a.fontFamily}",
47
+ ${a.weight?`fontWeight: ${a.weight}, `:``}${a.style?`fontStyle: "${a.style}",`:``}
48
+ },
49
+ };
50
+
51
+ if (cssModule.variable != null) {
52
+ fontData.variable = cssModule.variable;
53
+ }
54
+
55
+ export default fontData;`,u=`\0${i.replace(/\/$/,``)}/${l(n.variableName,t)}.js`;return e.set(u,c),u}else if(a===`@vercel/turbopack-next/internal/font/local/cssmodule.module.css`){let t=s(o),n=$(o),r=`${i.replace(/\/$/,``)}/${l(n.variableName,t)}.module.css`,a=await q(i.replace(/^\0/,``),n);if(a instanceof G)return this.error(`Font file not found: Can't resolve '${a.field0}'`);let c=Ke(n,a,Q(n,a),i);return e.set(r,c),r}return null}}});function Q(e,t){return{fontFamily:Ge(e,t),weight:Array.isArray(e.fonts)?void 0:e.fonts.weight?.type===`fixed`?e.fonts.weight.value:void 0,style:Array.isArray(e.fonts)?void 0:e.fonts.style,variable:e.variable}}function $(e){let t=new URLSearchParams(`${e.startsWith(`?`)?``:`?`}${e}`);if(t.size!==1)throw Error(`next-font/local queries must have exactly one entry`);let n=t.entries().next().value?.[0];if(!n)throw Error(`Expected one entry`);return We(JSON.parse(n))}const et=({virtualSources:e=new Map}={})=>$e({virtualSources:e}),tt=({fontFileMap:e,entryFileToFontFiles:t})=>{let n=`${x(`internal/font`)}/manifest.js`;return{name:`next-font-google:font-manifest`,resolveId:{order:`pre`,async handler(e,t){try{if(import.meta.resolve(e)===import.meta.resolve(`next-font/manifest`))return`\0${n}${t!=null&&t.length>0?`?importer=${encodeURIComponent(t)}`:``}`}catch{}}},load:{order:`pre`,filter:{id:L(`\0${n}`)},async handler(n){let r=d(n),i=r===n?``:n.slice(r.length+1);if(!i)return null;let a=decodeURIComponent(new URLSearchParams(`?${i}`).get(`importer`)??``)||null,o=Array.from(e.keys()).some(e=>e.includes(`-s`)),s=e.size>0?{app:Object.fromEntries(Array.from(t).map(([e,t])=>[e,Array.from(t).filter(e=>!e.includes(`.p.`))])),usingSizeAdjust:o}:{app:{},usingSizeAdjust:!1};return`const nextFontManifest = Object.freeze(${JSON.stringify(s)});
56
+ export function getPreloadableFonts(filePath${a?` = ${JSON.stringify(a)}`:``}) {
57
+ if (!filePath) return null
58
+ const filepathWithoutExtension = filePath.replace(/\\.[^.]+$/, '')
59
+ const fontFiles = new Set()
60
+ let foundFontUsage = false
61
+
62
+ const preloadedFontFiles = nextFontManifest.app[filepathWithoutExtension]
63
+ if (preloadedFontFiles) {
64
+ foundFontUsage = true
65
+ for (const fontFile of preloadedFontFiles) {
66
+ if (!injectedFontPreloadTags.has(fontFile)) {
67
+ fontFiles.add(fontFile)
68
+ injectedFontPreloadTags.add(fontFile)
69
+ }
70
+ }
71
+ }
72
+ if (fontFiles.size) {
73
+ return [...fontFiles].sort()
74
+ } else if (foundFontUsage && injectedFontPreloadTags.size === 0) {
75
+ return []
76
+ } else {
77
+ return null
78
+ }
79
+ }
80
+ export default { getPreloadableFonts }`}}}};export{L as a,oe as c,Me as i,et as n,F as o,Ue as r,x as s,tt as t};
@@ -0,0 +1,6 @@
1
+ import { Plugin } from "rolldown";
2
+
3
+ //#region src/rolldown.d.ts
4
+ declare const rolldownNextFont: () => Plugin[];
5
+ //#endregion
6
+ export { rolldownNextFont as default };
@@ -0,0 +1 @@
1
+ import{i as e,n as t,o as n,r,t as i}from"./rolldown-EavF8sBr.mjs";const a=()=>{let a=new Map,o=new Map,s=new Map;return[{name:`next-font:virtual-source`,async load(e){return o.has(e)?{code:await o.get(e),map:null}:null}},r({fontLoaders:n}),...e({fontFileMap:a,virtualSources:o,entryFileToFontFiles:s}),t({virtualSources:o}),i({fontFileMap:a,virtualSources:o,entryFileToFontFiles:s})]};export{a as default};
@@ -0,0 +1,6 @@
1
+ import { Plugin } from "vite";
2
+
3
+ //#region src/vite.d.ts
4
+ declare const viteNextFont: () => Plugin[];
5
+ //#endregion
6
+ export { viteNextFont as default };
package/dist/vite.mjs ADDED
@@ -0,0 +1 @@
1
+ import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./rolldown-EavF8sBr.mjs";import c from"node:path";import{version as l}from"vite";import{BindingMagicString as u}from"rolldown";var d=Object.create,f=Object.defineProperty,p=Object.getOwnPropertyDescriptor,m=Object.getOwnPropertyNames,h=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty,_=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),v=(e,t)=>{let n={};for(var r in e)f(n,r,{get:e[r],enumerable:!0});return t||f(n,Symbol.toStringTag,{value:`Module`}),n},y=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=m(t),a=0,o=i.length,s;a<o;a++)s=i[a],!g.call(e,s)&&s!==n&&f(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=p(t,s))||r.enumerable});return e},b=(e,t,n)=>(n=e==null?{}:d(h(e)),y(t||!e||!e.__esModule?f(n,`default`,{value:e,enumerable:!0}):n,e));v({addonFunctionCompat:()=>E,inputOptionsCompat:()=>S,minimalPluginContextCompat:()=>k,moduleInfoCompat:()=>M,normalizedInputOptionsCompat:()=>x,normalizedOutputOptionsCompat:()=>A,outputBundleCompat:()=>j,outputOptionsCompat:()=>C,pluginContextCompat:()=>D,transformPluginContext:()=>O});function x(e){return{...e,cwd:process.cwd(),platform:`neutral`,plugins:[]}}function S(e){return{...e,treeshake:e.treeshake==null?e.treeshake:typeof e.treeshake==`string`?{smallest:{propertyReadSideEffects:!1,moduleSideEffects:!1,unknownGlobalSideEffects:!1},safest:{},recommended:{unknownGlobalSideEffects:!1}}[e.treeshake]:typeof e.treeshake==`object`?{...e.treeshake,propertyReadSideEffects:e.treeshake.propertyReadSideEffects||!1}:e.treeshake}}function C(e){return{...e,format:e.format===`amd`||e.format===`system`||e.format===`systemjs`?void 0:e.format,banner:E(e.banner),footer:E(e.footer),intro:E(e.intro),outro:E(e.outro),assetFileNames:w(e.assetFileNames),entryFileNames:T(e.entryFileNames),chunkFileNames:T(e.chunkFileNames),generatedCode:e.generatedCode!=null&&typeof e.generatedCode==`string`?{preset:e.generatedCode}:e.generatedCode,manualChunks:e.manualChunks!=null&&typeof e.manualChunks==`object`?t=>Object.entries(e.manualChunks??{}).find(([,e])=>e.includes(t))?.[0]:typeof e.manualChunks==`function`?(t,n)=>e.manualChunks(t,{getModuleInfo(...e){let t=n.getModuleInfo(...e);return t?{...t,moduleSideEffects:t.moduleSideEffects??!1,dynamicallyImportedIdResolutions:[],exportedBindings:{},safeVariableNames:{},hasDefaultExport:!1,implicitlyLoadedAfterOneOf:[],implicitlyLoadedBefore:[],importedIdResolutions:[],isExternal:!1,isIncluded:!1,attributes:{},syntheticNamedExports:!1}:null},getModuleIds:this.getModuleIds}):e.manualChunks,hoistTransitiveImports:e.hoistTransitiveImports?void 0:!1}}const w=e=>e!=null&&typeof e==`function`?function(t){return e({...t,originalFileName:t.originalFileName??null,name:void 0})}:e,T=e=>typeof e==`function`?function(t){return e({...t,isImplicitEntry:!1,type:`chunk`,facadeModuleId:t.facadeModuleId??null})}:e,E=e=>e!=null&&typeof e==`function`?async t=>await e({...t,implicitlyLoadedBefore:[],importedBindings:{},referencedFiles:[],isImplicitEntry:!1,modules:Object.fromEntries(Object.entries(t.modules).map(([e,t])=>[e,{...t,originalLength:0,removedExports:[]}]))}):e;function D(e,t){return{...t,...k(e,t),getModuleInfo(...e){let n=t.getModuleInfo(...e);return n?M(n):null},async load(...e){return M(await t.load(...e))},parse(e,n){return t.parse(e,{jsx:n?.lang===`jsx`||n?.lang===`tsx`,allowReturnOutsideFunction:!0})}}}function O(e,t){return{...t,...D(e,t),getCombinedSourcemap(){return{file:``,mappings:``,names:[],sources:[],sourcesContent:[],version:3,toUrl(){return``},toString(){return``}}}}}function k(e,t){return{...t,pluginName:e.name,meta:{rolldownVersion:void 0,rollupVersion:t.meta.rollupVersion,watchMode:t.meta.watchMode}}}function A(e){let t=C.bind(this)(e),n=e=>e!=null&&typeof e==`string`?()=>e:e;return{...t,assetFileNames:t.assetFileNames,chunkFileNames:t.chunkFileNames,entryFileNames:t.entryFileNames,globals:t.globals,paths:t.paths,sourcemapIgnoreList:t.sourcemapIgnoreList,sourcemapPathTransform:t.sourcemapPathTransform,virtualDirname:t.virtualDirname,banner:n(t.banner),footer:n(t.footer),intro:n(t.intro),outro:n(t.outro),exports:e.exports??[],sourcemap:e.sourcemap??!1,sourcemapBaseUrl:t.sourcemapBaseUrl,inlineDynamicImports:t.inlineDynamicImports??!1,dynamicImportInCjs:t.dynamicImportInCjs??!1,externalLiveBindings:t.externalLiveBindings??!1,esModule:t.esModule??!1,extend:t.extend??!1,sourcemapDebugIds:t.sourcemapDebugIds??!1,preserveModules:t.preserveModules??!1,hashCharacters:t.hashCharacters??`base64`,codeSplitting:!1,postBanner:()=>``,postFooter:()=>``,minify:!1,legalComments:`none`,comments:{annotation:!1,jsdoc:!1,legal:!1},polyfillRequire:!1,name:t.name,file:t.file,dir:t.dir,format:e.format===`amd`||e.format===`system`?`es`:e.format,plugins:[]}}function j(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t]))}function M(e){return Object.assign({},e,{inputFormat:`unknown`,exports:e.exports??[]})}const N=/\\/g;function P(e){return e.replace(N,`/`)}function F(e){return Array.isArray(e)?e:[e]}function I(e){return e.flat(1/0)}function L(e){if(e===null)return!1;let t=typeof e;return t!==`object`&&t!==`function`?!1:typeof e.then==`function`}var R=_(((e,t)=>{let n=`[^\\\\/]`,r=`[^/]`,i=`(?:\\/|$)`,a=`(?:^|\\/)`,o=`\\.{1,2}${i}`,s={DOT_LITERAL:`\\.`,PLUS_LITERAL:`\\+`,QMARK_LITERAL:`\\?`,SLASH_LITERAL:`\\/`,ONE_CHAR:`(?=.)`,QMARK:r,END_ANCHOR:i,DOTS_SLASH:o,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!${a}${o})`,NO_DOT_SLASH:`(?!\\.{0,1}${i})`,NO_DOTS_SLASH:`(?!${o})`,QMARK_NO_DOT:`[^.\\/]`,STAR:`${r}*?`,START_ANCHOR:a,SEP:`/`},c={...s,SLASH_LITERAL:`[\\\\/]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`\\.{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!\\.{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!\\.{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:`[^.\\\\/]`,START_ANCHOR:`(?:^|[\\\\/])`,END_ANCHOR:`(?:[\\\\/]|$)`,SEP:`\\`};t.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:{alnum:`a-zA-Z0-9`,alpha:`a-zA-Z`,ascii:`\\x00-\\x7F`,blank:` \\t`,cntrl:`\\x00-\\x1F\\x7F`,digit:`0-9`,graph:`\\x21-\\x7E`,lower:`a-z`,print:`\\x20-\\x7E `,punct:`\\-!"#$%&'()\\*+,./:;<=>?@[\\]^_\`{|}~`,space:` \\t\\r\\n\\v\\f`,upper:`A-Z`,word:`A-Za-z0-9_`,xdigit:`A-Fa-f0-9`},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":`*`,"**/**":`**`,"**/**/**":`**`},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(e){return{"!":{type:`negate`,open:`(?:(?!(?:`,close:`))${e.STAR})`},"?":{type:`qmark`,open:`(?:`,close:`)?`},"+":{type:`plus`,open:`(?:`,close:`)+`},"*":{type:`star`,open:`(?:`,close:`)*`},"@":{type:`at`,open:`(?:`,close:`)`}}},globChars(e){return e===!0?c:s}}})),z=_((e=>{let{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=R();e.isObject=e=>typeof e==`object`&&!!e&&!Array.isArray(e),e.hasRegexChars=e=>r.test(e),e.isRegexChar=t=>t.length===1&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(i,`\\$1`),e.toPosixSlashes=e=>e.replace(t,`/`),e.isWindows=()=>{if(typeof navigator<`u`&&navigator.platform){let e=navigator.platform.toLowerCase();return e===`win32`||e===`windows`}return typeof process<`u`&&process.platform?process.platform===`win32`:!1},e.removeBackslashes=e=>e.replace(n,e=>e===`\\`?``:e),e.escapeLast=(t,n,r)=>{let i=t.lastIndexOf(n,r);return i===-1?t:t[i-1]===`\\`?e.escapeLast(t,n,i-1):`${t.slice(0,i)}\\${t.slice(i)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith(`./`)&&(n=n.slice(2),t.prefix=`./`),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?``:`^`}(?:${e})${n.contains?``:`$`}`;return t.negated===!0&&(r=`(?:^(?!${r}).*$)`),r},e.basename=(e,{windows:t}={})=>{let n=e.split(t?/[\\/]/:`/`),r=n[n.length-1];return r===``?n[n.length-2]:r}})),B=_(((e,t)=>{let n=z(),{CHAR_ASTERISK:r,CHAR_AT:i,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:c,CHAR_FORWARD_SLASH:l,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:d,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_PLUS:p,CHAR_QUESTION_MARK:m,CHAR_RIGHT_CURLY_BRACE:h,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:_}=R(),v=e=>e===l||e===a,y=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let b=t||{},x=e.length-1,S=b.parts===!0||b.scanToEnd===!0,C=[],w=[],T=[],E=e,D=-1,O=0,k=0,A=!1,j=!1,M=!1,N=!1,P=!1,F=!1,I=!1,L=!1,R=!1,z=!1,B=0,V,H,U={value:``,depth:0,isGlob:!1},W=()=>D>=x,G=()=>E.charCodeAt(D+1),K=()=>(V=H,E.charCodeAt(++D));for(;D<x;){H=K();let e;if(H===a){I=U.backslashes=!0,H=K(),H===u&&(F=!0);continue}if(F===!0||H===u){for(B++;W()!==!0&&(H=K());){if(H===a){I=U.backslashes=!0,K();continue}if(H===u){B++;continue}if(F!==!0&&H===s&&(H=K())===s){if(A=U.isBrace=!0,M=U.isGlob=!0,z=!0,S===!0)continue;break}if(F!==!0&&H===o){if(A=U.isBrace=!0,M=U.isGlob=!0,z=!0,S===!0)continue;break}if(H===h&&(B--,B===0)){F=!1,A=U.isBrace=!0,z=!0;break}}if(S===!0)continue;break}if(H===l){if(C.push(D),w.push(U),U={value:``,depth:0,isGlob:!1},z===!0)continue;if(V===s&&D===O+1){O+=2;continue}k=D+1;continue}if(b.noext!==!0&&(H===p||H===i||H===r||H===m||H===c)&&G()===d){if(M=U.isGlob=!0,N=U.isExtglob=!0,z=!0,H===c&&D===O&&(R=!0),S===!0){for(;W()!==!0&&(H=K());){if(H===a){I=U.backslashes=!0,H=K();continue}if(H===g){M=U.isGlob=!0,z=!0;break}}continue}break}if(H===r){if(V===r&&(P=U.isGlobstar=!0),M=U.isGlob=!0,z=!0,S===!0)continue;break}if(H===m){if(M=U.isGlob=!0,z=!0,S===!0)continue;break}if(H===f){for(;W()!==!0&&(e=K());){if(e===a){I=U.backslashes=!0,K();continue}if(e===_){j=U.isBracket=!0,M=U.isGlob=!0,z=!0;break}}if(S===!0)continue;break}if(b.nonegate!==!0&&H===c&&D===O){L=U.negated=!0,O++;continue}if(b.noparen!==!0&&H===d){if(M=U.isGlob=!0,S===!0){for(;W()!==!0&&(H=K());){if(H===d){I=U.backslashes=!0,H=K();continue}if(H===g){z=!0;break}}continue}break}if(M===!0){if(z=!0,S===!0)continue;break}}b.noext===!0&&(N=!1,M=!1);let q=E,J=``,Y=``;O>0&&(J=E.slice(0,O),E=E.slice(O),k-=O),q&&M===!0&&k>0?(q=E.slice(0,k),Y=E.slice(k)):M===!0?(q=``,Y=E):q=E,q&&q!==``&&q!==`/`&&q!==E&&v(q.charCodeAt(q.length-1))&&(q=q.slice(0,-1)),b.unescape===!0&&(Y&&=n.removeBackslashes(Y),q&&I===!0&&(q=n.removeBackslashes(q)));let X={prefix:J,input:e,start:O,base:q,glob:Y,isBrace:A,isBracket:j,isGlob:M,isExtglob:N,isGlobstar:P,negated:L,negatedExtglob:R};if(b.tokens===!0&&(X.maxDepth=0,v(H)||w.push(U),X.tokens=w),b.parts===!0||b.tokens===!0){let t;for(let n=0;n<C.length;n++){let r=t?t+1:O,i=C[n],a=e.slice(r,i);b.tokens&&(n===0&&O!==0?(w[n].isPrefix=!0,w[n].value=J):w[n].value=a,y(w[n]),X.maxDepth+=w[n].depth),(n!==0||a!==``)&&T.push(a),t=i}if(t&&t+1<e.length){let n=e.slice(t+1);T.push(n),b.tokens&&(w[w.length-1].value=n,y(w[w.length-1]),X.maxDepth+=w[w.length-1].depth)}X.slashes=C,X.parts=T}return X}})),V=_(((e,t)=>{let n=R(),r=z(),{MAX_LENGTH:i,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:c}=n,l=(e,t)=>{if(typeof t.expandRange==`function`)return t.expandRange(...e,t);e.sort();let n=`[${e.join(`-`)}]`;try{new RegExp(n)}catch{return e.map(e=>r.escapeRegex(e)).join(`..`)}return n},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,d=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);e=c[e]||e;let f={...t},p=typeof f.maxLength==`number`?Math.min(i,f.maxLength):i,m=e.length;if(m>p)throw SyntaxError(`Input length: ${m}, exceeds maximum allowed length: ${p}`);let h={type:`bos`,value:``,output:f.prepend||``},g=[h],_=f.capture?``:`?:`,v=n.globChars(f.windows),y=n.extglobChars(v),{DOT_LITERAL:b,PLUS_LITERAL:x,SLASH_LITERAL:S,ONE_CHAR:C,DOTS_SLASH:w,NO_DOT:T,NO_DOT_SLASH:E,NO_DOTS_SLASH:D,QMARK:O,QMARK_NO_DOT:k,STAR:A,START_ANCHOR:j}=v,M=e=>`(${_}(?:(?!${j}${e.dot?w:b}).)*?)`,N=f.dot?``:T,P=f.dot?O:k,F=f.bash===!0?M(f):A;f.capture&&(F=`(${F})`),typeof f.noext==`boolean`&&(f.noextglob=f.noext);let I={input:e,index:-1,start:0,dot:f.dot===!0,consumed:``,output:``,prefix:``,backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:g};e=r.removePrefix(e,I),m=e.length;let L=[],R=[],z=[],B=h,V,H=()=>I.index===m-1,U=I.peek=(t=1)=>e[I.index+t],W=I.advance=()=>e[++I.index]||``,G=()=>e.slice(I.index+1),K=(e=``,t=0)=>{I.consumed+=e,I.index+=t},q=e=>{I.output+=e.output==null?e.value:e.output,K(e.value)},J=()=>{let e=1;for(;U()===`!`&&(U(2)!==`(`||U(3)===`?`);)W(),I.start++,e++;return e%2==0?!1:(I.negated=!0,I.start++,!0)},Y=e=>{I[e]++,z.push(e)},X=e=>{I[e]--,z.pop()},Z=e=>{if(B.type===`globstar`){let t=I.braces>0&&(e.type===`comma`||e.type===`brace`),n=e.extglob===!0||L.length&&(e.type===`pipe`||e.type===`paren`);e.type!==`slash`&&e.type!==`paren`&&!t&&!n&&(I.output=I.output.slice(0,-B.output.length),B.type=`star`,B.value=`*`,B.output=F,I.output+=B.output)}if(L.length&&e.type!==`paren`&&(L[L.length-1].inner+=e.value),(e.value||e.output)&&q(e),B&&B.type===`text`&&e.type===`text`){B.output=(B.output||B.value)+e.value,B.value+=e.value;return}e.prev=B,g.push(e),B=e},Q=(e,t)=>{let n={...y[t],conditions:1,inner:``};n.prev=B,n.parens=I.parens,n.output=I.output;let r=(f.capture?`(`:``)+n.open;Y(`parens`),Z({type:e,value:t,output:I.output?``:C}),Z({type:`paren`,extglob:!0,value:W(),output:r}),L.push(n)},ee=e=>{let n=e.close+(f.capture?`)`:``),r;if(e.type===`negate`){let i=F;e.inner&&e.inner.length>1&&e.inner.includes(`/`)&&(i=M(f)),(i!==F||H()||/^\)+$/.test(G()))&&(n=e.close=`)$))${i}`),e.inner.includes(`*`)&&(r=G())&&/^\.[^\\/.]+$/.test(r)&&(n=e.close=`)${d(r,{...t,fastpaths:!1}).output})${i})`),e.prev.type===`bos`&&(I.negatedExtglob=!0)}Z({type:`paren`,extglob:!0,value:V,output:n}),X(`parens`)};if(f.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let n=!1,i=e.replace(s,(e,t,r,i,a,o)=>i===`\\`?(n=!0,e):i===`?`?t?t+i+(a?O.repeat(a.length):``):o===0?P+(a?O.repeat(a.length):``):O.repeat(r.length):i===`.`?b.repeat(r.length):i===`*`?t?t+i+(a?F:``):F:t?e:`\\${e}`);return n===!0&&(i=f.unescape===!0?i.replace(/\\/g,``):i.replace(/\\+/g,e=>e.length%2==0?`\\\\`:e?`\\`:``)),i===e&&f.contains===!0?(I.output=e,I):(I.output=r.wrapOutput(i,I,t),I)}for(;!H();){if(V=W(),V===`\0`)continue;if(V===`\\`){let e=U();if(e===`/`&&f.bash!==!0||e===`.`||e===`;`)continue;if(!e){V+=`\\`,Z({type:`text`,value:V});continue}let t=/^\\+/.exec(G()),n=0;if(t&&t[0].length>2&&(n=t[0].length,I.index+=n,n%2!=0&&(V+=`\\`)),f.unescape===!0?V=W():V+=W(),I.brackets===0){Z({type:`text`,value:V});continue}}if(I.brackets>0&&(V!==`]`||B.value===`[`||B.value===`[^`)){if(f.posix!==!1&&V===`:`){let e=B.value.slice(1);if(e.includes(`[`)&&(B.posix=!0,e.includes(`:`))){let e=B.value.lastIndexOf(`[`),t=B.value.slice(0,e),n=a[B.value.slice(e+2)];if(n){B.value=t+n,I.backtrack=!0,W(),!h.output&&g.indexOf(B)===1&&(h.output=C);continue}}}(V===`[`&&U()!==`:`||V===`-`&&U()===`]`)&&(V=`\\${V}`),V===`]`&&(B.value===`[`||B.value===`[^`)&&(V=`\\${V}`),f.posix===!0&&V===`!`&&B.value===`[`&&(V=`^`),B.value+=V,q({value:V});continue}if(I.quotes===1&&V!==`"`){V=r.escapeRegex(V),B.value+=V,q({value:V});continue}if(V===`"`){I.quotes=I.quotes===1?0:1,f.keepQuotes===!0&&Z({type:`text`,value:V});continue}if(V===`(`){Y(`parens`),Z({type:`paren`,value:V});continue}if(V===`)`){if(I.parens===0&&f.strictBrackets===!0)throw SyntaxError(u(`opening`,`(`));let e=L[L.length-1];if(e&&I.parens===e.parens+1){ee(L.pop());continue}Z({type:`paren`,value:V,output:I.parens?`)`:`\\)`}),X(`parens`);continue}if(V===`[`){if(f.nobracket===!0||!G().includes(`]`)){if(f.nobracket!==!0&&f.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));V=`\\${V}`}else Y(`brackets`);Z({type:`bracket`,value:V});continue}if(V===`]`){if(f.nobracket===!0||B&&B.type===`bracket`&&B.value.length===1){Z({type:`text`,value:V,output:`\\${V}`});continue}if(I.brackets===0){if(f.strictBrackets===!0)throw SyntaxError(u(`opening`,`[`));Z({type:`text`,value:V,output:`\\${V}`});continue}X(`brackets`);let e=B.value.slice(1);if(B.posix!==!0&&e[0]===`^`&&!e.includes(`/`)&&(V=`/${V}`),B.value+=V,q({value:V}),f.literalBrackets===!1||r.hasRegexChars(e))continue;let t=r.escapeRegex(B.value);if(I.output=I.output.slice(0,-B.value.length),f.literalBrackets===!0){I.output+=t,B.value=t;continue}B.value=`(${_}${t}|${B.value})`,I.output+=B.value;continue}if(V===`{`&&f.nobrace!==!0){Y(`braces`);let e={type:`brace`,value:V,output:`(`,outputIndex:I.output.length,tokensIndex:I.tokens.length};R.push(e),Z(e);continue}if(V===`}`){let e=R[R.length-1];if(f.nobrace===!0||!e){Z({type:`text`,value:V,output:V});continue}let t=`)`;if(e.dots===!0){let e=g.slice(),n=[];for(let t=e.length-1;t>=0&&(g.pop(),e[t].type!==`brace`);t--)e[t].type!==`dots`&&n.unshift(e[t].value);t=l(n,f),I.backtrack=!0}if(e.comma!==!0&&e.dots!==!0){let n=I.output.slice(0,e.outputIndex),r=I.tokens.slice(e.tokensIndex);e.value=e.output=`\\{`,V=t=`\\}`,I.output=n;for(let e of r)I.output+=e.output||e.value}Z({type:`brace`,value:V,output:t}),X(`braces`),R.pop();continue}if(V===`|`){L.length>0&&L[L.length-1].conditions++,Z({type:`text`,value:V});continue}if(V===`,`){let e=V,t=R[R.length-1];t&&z[z.length-1]===`braces`&&(t.comma=!0,e=`|`),Z({type:`comma`,value:V,output:e});continue}if(V===`/`){if(B.type===`dot`&&I.index===I.start+1){I.start=I.index+1,I.consumed=``,I.output=``,g.pop(),B=h;continue}Z({type:`slash`,value:V,output:S});continue}if(V===`.`){if(I.braces>0&&B.type===`dot`){B.value===`.`&&(B.output=b);let e=R[R.length-1];B.type=`dots`,B.output+=V,B.value+=V,e.dots=!0;continue}if(I.braces+I.parens===0&&B.type!==`bos`&&B.type!==`slash`){Z({type:`text`,value:V,output:b});continue}Z({type:`dot`,value:V,output:b});continue}if(V===`?`){if(!(B&&B.value===`(`)&&f.noextglob!==!0&&U()===`(`&&U(2)!==`?`){Q(`qmark`,V);continue}if(B&&B.type===`paren`){let e=U(),t=V;(B.value===`(`&&!/[!=<:]/.test(e)||e===`<`&&!/<([!=]|\w+>)/.test(G()))&&(t=`\\${V}`),Z({type:`text`,value:V,output:t});continue}if(f.dot!==!0&&(B.type===`slash`||B.type===`bos`)){Z({type:`qmark`,value:V,output:k});continue}Z({type:`qmark`,value:V,output:O});continue}if(V===`!`){if(f.noextglob!==!0&&U()===`(`&&(U(2)!==`?`||!/[!=<:]/.test(U(3)))){Q(`negate`,V);continue}if(f.nonegate!==!0&&I.index===0){J();continue}}if(V===`+`){if(f.noextglob!==!0&&U()===`(`&&U(2)!==`?`){Q(`plus`,V);continue}if(B&&B.value===`(`||f.regex===!1){Z({type:`plus`,value:V,output:x});continue}if(B&&(B.type===`bracket`||B.type===`paren`||B.type===`brace`)||I.parens>0){Z({type:`plus`,value:V});continue}Z({type:`plus`,value:x});continue}if(V===`@`){if(f.noextglob!==!0&&U()===`(`&&U(2)!==`?`){Z({type:`at`,extglob:!0,value:V,output:``});continue}Z({type:`text`,value:V});continue}if(V!==`*`){(V===`$`||V===`^`)&&(V=`\\${V}`);let e=o.exec(G());e&&(V+=e[0],I.index+=e[0].length),Z({type:`text`,value:V});continue}if(B&&(B.type===`globstar`||B.star===!0)){B.type=`star`,B.star=!0,B.value+=V,B.output=F,I.backtrack=!0,I.globstar=!0,K(V);continue}let t=G();if(f.noextglob!==!0&&/^\([^?]/.test(t)){Q(`star`,V);continue}if(B.type===`star`){if(f.noglobstar===!0){K(V);continue}let n=B.prev,r=n.prev,i=n.type===`slash`||n.type===`bos`,a=r&&(r.type===`star`||r.type===`globstar`);if(f.bash===!0&&(!i||t[0]&&t[0]!==`/`)){Z({type:`star`,value:V,output:``});continue}let o=I.braces>0&&(n.type===`comma`||n.type===`brace`),s=L.length&&(n.type===`pipe`||n.type===`paren`);if(!i&&n.type!==`paren`&&!o&&!s){Z({type:`star`,value:V,output:``});continue}for(;t.slice(0,3)===`/**`;){let n=e[I.index+4];if(n&&n!==`/`)break;t=t.slice(3),K(`/**`,3)}if(n.type===`bos`&&H()){B.type=`globstar`,B.value+=V,B.output=M(f),I.output=B.output,I.globstar=!0,K(V);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&!a&&H()){I.output=I.output.slice(0,-(n.output+B.output).length),n.output=`(?:${n.output}`,B.type=`globstar`,B.output=M(f)+(f.strictSlashes?`)`:`|$)`),B.value+=V,I.globstar=!0,I.output+=n.output+B.output,K(V);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&t[0]===`/`){let e=t[1]===void 0?``:`|$`;I.output=I.output.slice(0,-(n.output+B.output).length),n.output=`(?:${n.output}`,B.type=`globstar`,B.output=`${M(f)}${S}|${S}${e})`,B.value+=V,I.output+=n.output+B.output,I.globstar=!0,K(V+W()),Z({type:`slash`,value:`/`,output:``});continue}if(n.type===`bos`&&t[0]===`/`){B.type=`globstar`,B.value+=V,B.output=`(?:^|${S}|${M(f)}${S})`,I.output=B.output,I.globstar=!0,K(V+W()),Z({type:`slash`,value:`/`,output:``});continue}I.output=I.output.slice(0,-B.output.length),B.type=`globstar`,B.output=M(f),B.value+=V,I.output+=B.output,I.globstar=!0,K(V);continue}let n={type:`star`,value:V,output:F};if(f.bash===!0){n.output=`.*?`,(B.type===`bos`||B.type===`slash`)&&(n.output=N+n.output),Z(n);continue}if(B&&(B.type===`bracket`||B.type===`paren`)&&f.regex===!0){n.output=V,Z(n);continue}(I.index===I.start||B.type===`slash`||B.type===`dot`)&&(B.type===`dot`?(I.output+=E,B.output+=E):f.dot===!0?(I.output+=D,B.output+=D):(I.output+=N,B.output+=N),U()!==`*`&&(I.output+=C,B.output+=C)),Z(n)}for(;I.brackets>0;){if(f.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));I.output=r.escapeLast(I.output,`[`),X(`brackets`)}for(;I.parens>0;){if(f.strictBrackets===!0)throw SyntaxError(u(`closing`,`)`));I.output=r.escapeLast(I.output,`(`),X(`parens`)}for(;I.braces>0;){if(f.strictBrackets===!0)throw SyntaxError(u(`closing`,`}`));I.output=r.escapeLast(I.output,`{`),X(`braces`)}if(f.strictSlashes!==!0&&(B.type===`star`||B.type===`bracket`)&&Z({type:`maybe_slash`,value:``,output:`${S}?`}),I.backtrack===!0){I.output=``;for(let e of I.tokens)I.output+=e.output==null?e.value:e.output,e.suffix&&(I.output+=e.suffix)}return I};d.fastpaths=(e,t)=>{let a={...t},o=typeof a.maxLength==`number`?Math.min(i,a.maxLength):i,s=e.length;if(s>o)throw SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${o}`);e=c[e]||e;let{DOT_LITERAL:l,SLASH_LITERAL:u,ONE_CHAR:d,DOTS_SLASH:f,NO_DOT:p,NO_DOTS:m,NO_DOTS_SLASH:h,STAR:g,START_ANCHOR:_}=n.globChars(a.windows),v=a.dot?m:p,y=a.dot?h:p,b=a.capture?``:`?:`,x={negated:!1,prefix:``},S=a.bash===!0?`.*?`:g;a.capture&&(S=`(${S})`);let C=e=>e.noglobstar===!0?S:`(${b}(?:(?!${_}${e.dot?f:l}).)*?)`,w=e=>{switch(e){case`*`:return`${v}${d}${S}`;case`.*`:return`${l}${d}${S}`;case`*.*`:return`${v}${S}${l}${d}${S}`;case`*/*`:return`${v}${S}${u}${d}${y}${S}`;case`**`:return v+C(a);case`**/*`:return`(?:${v}${C(a)}${u})?${y}${d}${S}`;case`**/*.*`:return`(?:${v}${C(a)}${u})?${y}${S}${l}${d}${S}`;case`**/.*`:return`(?:${v}${C(a)}${u})?${l}${d}${S}`;default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=w(t[1]);return n?n+l+t[2]:void 0}}},T=w(r.removePrefix(e,x));return T&&a.strictSlashes!==!0&&(T+=`${u}?`),T},t.exports=d})),H=_(((e,t)=>{let n=B(),r=V(),i=z(),a=R(),o=e=>e&&typeof e==`object`&&!Array.isArray(e),s=(e,t,n=!1)=>{if(Array.isArray(e)){let r=e.map(e=>s(e,t,n));return e=>{for(let t of r){let n=t(e);if(n)return n}return!1}}let r=o(e)&&e.tokens&&e.input;if(e===``||typeof e!=`string`&&!r)throw TypeError(`Expected pattern to be a non-empty string`);let i=t||{},a=i.windows,c=r?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=c.state;delete c.state;let u=()=>!1;if(i.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};u=s(i.ignore,e,n)}let d=(n,r=!1)=>{let{isMatch:o,match:d,output:f}=s.test(n,c,t,{glob:e,posix:a}),p={glob:e,state:l,regex:c,posix:a,input:n,output:f,match:d,isMatch:o};return typeof i.onResult==`function`&&i.onResult(p),o===!1?(p.isMatch=!1,r?p:!1):u(n)?(typeof i.onIgnore==`function`&&i.onIgnore(p),p.isMatch=!1,r?p:!1):(typeof i.onMatch==`function`&&i.onMatch(p),r?p:!0)};return n&&(d.state=l),d};s.test=(e,t,n,{glob:r,posix:a}={})=>{if(typeof e!=`string`)throw TypeError(`Expected input to be a string`);if(e===``)return{isMatch:!1,output:``};let o=n||{},c=o.format||(a?i.toPosixSlashes:null),l=e===r,u=l&&c?c(e):e;return l===!1&&(u=c?c(e):e,l=u===r),(l===!1||o.capture===!0)&&(l=o.matchBase===!0||o.basename===!0?s.matchBase(e,t,n,a):t.exec(u)),{isMatch:!!l,match:l,output:u}},s.matchBase=(e,t,n)=>(t instanceof RegExp?t:s.makeRe(t,n)).test(i.basename(e)),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map(e=>s.parse(e,t)):r(e,{...t,fastpaths:!1}),s.scan=(e,t)=>n(e,t),s.compileRe=(e,t,n=!1,r=!1)=>{if(n===!0)return e.output;let i=t||{},a=i.contains?``:`^`,o=i.contains?``:`$`,c=`${a}(?:${e.output})${o}`;e&&e.negated===!0&&(c=`^(?!${c}).*$`);let l=s.toRegex(c,t);return r===!0&&(l.state=e),l},s.makeRe=(e,t={},n=!1,i=!1)=>{if(!e||typeof e!=`string`)throw TypeError(`Expected a non-empty string`);let a={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]===`.`||e[0]===`*`)&&(a.output=r.fastpaths(e,t)),a.output||(a=r(e,t)),s.compileRe(a,t,n,i)},s.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?`i`:``))}catch(e){if(t&&t.debug===!0)throw e;return/$^/}},s.constants=a,t.exports=s})),U=b(_(((e,t)=>{let n=H(),r=z();function i(e,t,i=!1){return t&&(t.windows===null||t.windows===void 0)&&(t={...t,windows:r.isWindows()}),n(e,t,i)}Object.assign(i,n),t.exports=i}))(),1);function W(e,t){return e.startsWith(`**`)||c.isAbsolute(e)?P(e):P(c.join(t,e))}function G(e,t){if(e instanceof RegExp)return t=>{let n=P(t),r=e.test(n);return e.lastIndex=0,r};let n=(0,U.default)(W(e,t),{dot:!0});return e=>n(P(e))}function K(e){return e instanceof RegExp?t=>{let n=e.test(t);return e.lastIndex=0,n}:t=>t.includes(e)}function q(e,t){if(!(!e&&!t))return n=>e?.some(e=>e(n))?!1:t?.some(e=>e(n))?!0:!(t&&t.length>0)}function J(e){return typeof e==`string`||e instanceof RegExp?{include:[e]}:Array.isArray(e)?{include:e}:{include:e.include?F(e.include):void 0,exclude:e.exclude?F(e.exclude):void 0}}function Y(e,t=process.cwd()){if(!e)return;let{exclude:n,include:r}=J(e),i=n?.map(e=>G(e,t)),a=r?.map(e=>G(e,t));return q(i,a)}function X(e){if(!e)return;let{exclude:t,include:n}=J(e),r=t?.map(K),i=n?.map(K);return q(r,i)}function Z(e){if(!e)return;let t=Array.isArray(e)?e:e.include??[];return e=>t.includes(e)}function Q(e,t,n,r){if(!e&&!t&&!n)return;let i=Y(e,r),a=X(t),o=Z(n);return(e,t,n)=>{let r=o?.(n)??!0;return!r||(i&&(r&&=i(e)),!r)?!1:(a&&(r&&=a(t)),r)}}const ee=/[?#].*$/;function te(e){return e.replace(ee,``)}function ne(e){let t=e.indexOf(`?`);if(t===-1)return``;let n=e.indexOf(`#`,t);return n===-1?e.substring(t):e.substring(t,n)}function re(e,t,n,r,i,a={}){let o=!1;for(let s of e)switch(s.kind){case`include`:if(o=!0,ie(s.expr,t,n,r,i,a))return!0;break;case`exclude`:if(ie(s.expr,t,n,r,i,a))return!1;break}return!o}function ie(e,t,n,r,i,a={}){switch(e.kind){case`and`:return e.args.every(e=>ie(e,t,n,r,i,a));case`or`:return e.args.some(e=>ie(e,t,n,r,i,a));case`not`:return!ie(e.expr,t,n,r,i,a);case`id`:{if(n===void 0)throw Error("`id` is required for `id` expression");let t=n;return e.params.cleanUrl&&(t=te(t)),typeof e.pattern==`string`?t===e.pattern:e.pattern.test(t)}case`importerId`:{if(i===void 0)return!1;let t=i;return e.params.cleanUrl&&(t=te(t)),typeof e.pattern==`string`?t===e.pattern:e.pattern.test(t)}case`moduleType`:if(r===void 0)throw Error("`moduleType` is required for `moduleType` expression");return r===e.pattern;case`code`:if(t===void 0)throw Error("`code` is required for `code` expression");return typeof e.pattern==`string`?t.includes(e.pattern):e.pattern.test(t);case`query`:{if(n===void 0)throw Error("`id` is required for `Query` expression");if(!a.urlSearchParamsCache){let e=ne(n);a.urlSearchParamsCache=new URLSearchParams(e)}let t=a.urlSearchParamsCache;return typeof e.pattern==`boolean`?e.pattern?t.has(e.key):!t.has(e.key):typeof e.pattern==`string`?t.get(e.key)===e.pattern:e.pattern.test(t.get(e.key)??``)}default:throw Error(`Expression ${JSON.stringify(e)} is not expected.`)}}function $(e){return typeof e==`object`&&e&&`handler`in e&&e.handler?e.handler:e}function ae(e){return typeof e==`object`&&e&&`filter`in e&&e.filter?e.filter:void 0}const oe=new WeakMap;function se(e,t){let n=oe.get(e);if(n&&t in n)return n[t];n||(n={},oe.set(e,n));let r;switch(t){case`resolveId`:{let t=ae(e.resolveId);n.resolveId=Array.isArray(t)?(...e)=>re(t,void 0,...e):Y(t?.id),r=n.resolveId;break}case`load`:{let t=ae(e.load);n.load=Array.isArray(t)?(...e)=>re(t,void 0,...e):Y(t?.id),r=n.load;break}case`transform`:{let t=ae(e.transform);n.transform=Array.isArray(t)?(...e)=>re(t,void 0,...e):Q(t?.id,t?.code,t?.moduleType),r=n.transform;break}}return r}var ce=v({pluginCompat:()=>ue,pluginsCompat:()=>le,sourceDescriptionCompat:()=>de});function le(e){return e==null?[]:I(F(e)).map(e=>e!=0&&e!=null?L(e)?e.then(e=>e!=0&&e!=null?le(e):e):typeof e==`object`&&e?`name`in e?ue(e):void 0:e:void 0).filter(e=>!!e)}function ue(e){let t=e=>{let t=$(e);return typeof t==`object`||typeof t==`function`?me(t):t},n=(t,n,r,i=(e=>e))=>{if(!n)return;let a=$(n),o=se(e,t);return{order:typeof n==`object`&&n&&`order`in n?n.order:void 0,handler:async function(...e){let t=r.call(this,...e);if(o&&!o(...t))return;let n=await a.call(this,...t);return i?i.call(this,n):n}}};return{...e,name:e.name,options:e.options==null?void 0:async function(t){let n=await $(e.options).bind(k(e,this))(S(t));return n&&fe(n)},outputOptions:e.outputOptions==null?e.outputOptions:function(t){if(e.outputOptions==null)return null;let n=$(e.outputOptions).bind(D(e,this))(C.bind(this)(t));return n&&pe(n)},banner:t(e.banner),footer:t(e.footer),intro:t(e.intro),outro:t(e.outro),resolveId:n(`resolveId`,e.resolveId,function(t,n,r){return[D(e,this),t,n,{...r,kind:`import-statement`}]}),load:n(`load`,e.load,function(t){return[D(e,this),t]},de),transform:n(`transform`,e.transform,function(t,n,r){return[D(e,this),t,n,{...r,moduleType:c.extname(n).slice(1)}]},e=>de(e,!0)),augmentChunkHash:e.augmentChunkHash==null?e.augmentChunkHash:function(...t){if(e.augmentChunkHash!=null)return $(e.augmentChunkHash).bind(D(e,this))(...t)},renderChunk:e.renderChunk==null?e.renderChunk:async function(t,n,r,i){if(!e.renderChunk)return null;let a=await $(e.renderChunk).bind(D(e,this))(t,n,A.bind(this)(r),i);return a?a instanceof u?a.original:typeof a==`object`?{code:a.code instanceof u?a.code.original:a.code,map:a.map==null?void 0:typeof a.map==`string`?a.map:{...a.map,file:a.map.file??void 0,names:a.map.names??[],sources:a.map.sources?.filter(e=>e!=null)??[],sourcesContent:a.map.sourcesContent?.filter(e=>e!=null)??[],version:a.map.version??3}}:a:null},renderStart:e.renderStart==null?e.renderStart:async function(t,n){if(e.renderStart)return await $(e.renderStart).bind(D(e,this))(A.bind(this)(t),x.bind(this)(n))},renderError:e.renderError==null?e.renderError:async function(t){if(t!=null)return await $(e.renderError).bind(D(e,this))(t)},writeBundle:e.writeBundle==null?e.writeBundle:async function(t,n){return await $(e.writeBundle).bind(D(e,this))(A.bind(this)(t),j(n))},generateBundle:e.generateBundle==null?e.generateBundle:async function(t,n,r){await $(e.generateBundle).bind(D(e,this))(A.bind(this)(t),j(n),r)},closeBundle:e.closeBundle==null?e.closeBundle:async function(){await $(e.closeBundle).bind(D(e,this))()},buildStart:e.buildStart==null?e.buildStart:async function(t){await $(e.buildStart).bind(D(e,this))(x.bind(this)(t))},buildEnd:e.buildEnd==null?e.buildEnd:async function(){await $(e.buildEnd).bind(D(e,this))()},watchChange:e.watchChange==null?void 0:function(t,n){return $(e.watchChange).bind(D(e,this))(t,n)},closeWatcher:e.closeWatcher==null?e.closeWatcher:async function(){await $(e.closeWatcher).bind(D(e,this))()},moduleParsed:e.moduleParsed==null?void 0:async function(t){await $(e.moduleParsed).bind(D(e,this))(M(t))},resolveDynamicImport:e.resolveDynamicImport==null?void 0:function(t,n){let r=$(e.resolveDynamicImport);if(typeof t!=`string`){console.warn("[rollxxx] attempted to pass `source` that is not a string to resolveDynamicImport hook");return}return r.bind(D(e,this))(t,n)},onLog:e.onLog==null?void 0:function(t,n){return $(e.onLog).bind(k(e,this))(t,n)}}}function de(e,t=!1){return typeof e==`object`&&e?{code:t&&e.code instanceof u?e.code.original:e.code,map:e.map==null?void 0:typeof e.map==`string`?e.map:{...e.map,file:e.map.file??void 0,names:e.map.names??[],sources:e.map.sources?.filter(Boolean)??[],sourcesContent:e.map.sourcesContent?.filter(Boolean)??[],version:e.map.version??3}}:e}function fe(e){return{...e,plugins:e.plugins==null?void 0:le(e.plugins),treeshake:e.treeshake!=null&&typeof e.treeshake==`object`?{...e.treeshake,moduleSideEffects:e.treeshake.moduleSideEffects!=null&&typeof e.treeshake.moduleSideEffects==`function`?(e=>(...t)=>e(...t)??!1)(e.treeshake.moduleSideEffects):Array.isArray(e.treeshake.moduleSideEffects)&&e.treeshake.moduleSideEffects.length>0&&typeof e.treeshake.moduleSideEffects[0]==`object`?(e=>(t,n)=>{let r=e.find(e=>e.test?.test(t)??!1);return r?.sideEffects??r?.external??n})(e.treeshake.moduleSideEffects):e.treeshake.moduleSideEffects,propertyReadSideEffects:e.treeshake.propertyReadSideEffects??void 0}:e.treeshake}}function pe(e){return{...e,assetFileNames:typeof e.assetFileNames==`function`?function(t){return e.assetFileNames({...t,originalFileName:t.originalFileName??void 0,name:void 0})??null}:e.assetFileNames,chunkFileNames:typeof e.chunkFileNames==`function`?function(t){return e.chunkFileNames({...t,facadeModuleId:t.facadeModuleId??void 0})}:e.chunkFileNames,entryFileNames:typeof e.entryFileNames==`function`?function(t){return e.entryFileNames({...t,facadeModuleId:t.facadeModuleId??void 0})}:e.entryFileNames,generatedCode:e.generatedCode!=null&&typeof e.generatedCode==`string`?{preset:e.generatedCode}:e.generatedCode,manualChunks:e.manualChunks!=null&&typeof e.manualChunks==`object`?t=>Object.entries(e.manualChunks??{}).find(([,e])=>e.includes(t))?.[0]:typeof e.manualChunks==`function`?(t,n)=>e.manualChunks(t,{getModuleInfo(...e){let t=n.getModuleInfo(...e);return t?{...t,exports:t.exports??[],moduleSideEffects:t.moduleSideEffects??!1,dynamicallyImportedIdResolutions:[],exportedBindings:{},safeVariableNames:{},hasDefaultExport:!1,implicitlyLoadedAfterOneOf:[],implicitlyLoadedBefore:[],importedIdResolutions:[],isExternal:!1,isIncluded:!1,attributes:{},syntheticNamedExports:!1,inputFormat:`unknown`}:null}}):e.manualChunks,hoistTransitiveImports:e.hoistTransitiveImports?void 0:!1,plugins:e.plugins==null?void 0:le(I(F(e.plugins))),sourcemapIgnoreList:typeof e.sourcemapIgnoreList==`string`||e.sourcemapIgnoreList instanceof RegExp?t=>typeof e.sourcemapIgnoreList==`string`?t===e.sourcemapIgnoreList:e.sourcemapIgnoreList.test(t):e.sourcemapIgnoreList,strict:e.strict===`auto`?!1:e.strict}}function me(e){return e!=null&&(typeof e==`object`||typeof e==`function`)?{handler:he(typeof e==`object`?e.handler:e),order:typeof e==`object`?e.order:null}:e}function he(e){return e!=null&&typeof e==`function`?(async t=>await e({...t,implicitlyLoadedBefore:[],importedBindings:{},referencedFiles:[],isImplicitEntry:!1,modules:Object.fromEntries(Object.entries(t.modules).map(([e,t])=>[e,{...t,originalLength:0,removedExports:[]}]))})):e}const ge=()=>{let c=parseInt(l.split(`.`)[0]??`0`,10),u=new Map,d=new Map,f=new Map,p=a({fontLoaders:i}),m=[{name:`next-font:virtual-source`,async load(e){return d.has(e)?{code:await d.get(e),map:null}:null}},Object.assign({},p,{transform:Object.assign({},p.transform,{filter:{id:/\.(?:j|t)sx?$|\.(c|m)js$/}})}),...n({fontFileMap:u,virtualSources:d,entryFileToFontFiles:f}),{name:`next-font:font-file-replacer`,async config(n){return{build:{rolldownOptions:{external:[e(`/${n.build?.assetsDir??`assets`}/${t(o(``))}`)]}}}},configureServer(e){e.middlewares.use(async(e,t,n)=>{let r=e.originalUrl?.startsWith(`/`)?e.originalUrl.slice(1):e.originalUrl;if(r!=null&&u.has(r)){let e=u.get(r);return t.end(e)}n()})}},r({virtualSources:d}),s({fontFileMap:u,virtualSources:d,entryFileToFontFiles:f})];return c<8?ce.pluginsCompat(m):m};export{ge as default};
package/package.json CHANGED
@@ -1,65 +1,65 @@
1
1
  {
2
2
  "name": "next-font",
3
- "description": "@next/font (next/font) replacement",
4
- "version": "1.2.0",
3
+ "version": "1.2.2-beta.0",
4
+ "description": "@next/font (next/font) drop-in replacement",
5
5
  "license": "BSD-2-Clause",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/kijv/next-font.git",
9
+ "directory": "packages/next-font"
10
+ },
6
11
  "files": [
7
- "dist",
8
- "google",
9
- "local",
10
- "manifest"
12
+ "dist"
11
13
  ],
12
14
  "type": "module",
13
- "main": "./dist/index.js",
14
- "types": "./dist/index.d.ts",
15
15
  "exports": {
16
16
  "./google": {
17
- "import": "./google/index.js",
18
- "types": "./google/index.d.ts"
17
+ "types": "./dist/google/index.d.mts",
18
+ "default": "./dist/google/index.mjs"
19
19
  },
20
20
  "./local": {
21
- "import": "./local/index.js",
22
- "types": "./local/index.d.ts"
21
+ "types": "./dist/local.d.mts",
22
+ "default": "./dist/local.mjs"
23
23
  },
24
- "./google/loader": {
25
- "import": "./google/loader.js",
26
- "types": "./google/loader.d.ts"
27
- },
28
- "./local/loader": {
29
- "import": "./local/loader.js",
30
- "types": "./local/loader.d.ts"
31
- },
32
- "./google/target.css": "./google/target.css",
33
- "./local/target.css": "./local/target.css",
34
24
  "./manifest": {
35
- "import": "./manifest/index.js",
36
- "types": "./manifest/index.d.ts"
25
+ "types": "./dist/manifest.d.mts",
26
+ "default": "./dist/manifest.mjs"
37
27
  },
38
- "./dist/*": {
39
- "import": "./dist/*.js",
40
- "types": "./dist/*.d.ts"
28
+ "./rolldown": {
29
+ "types": "./dist/rolldown.d.mts",
30
+ "default": "./dist/rolldown.mjs"
41
31
  },
42
- ".": {
43
- "import": "./dist/index.js",
44
- "types": "./dist/index.d.ts"
32
+ "./vite": {
33
+ "types": "./dist/vite.d.mts",
34
+ "default": "./dist/vite.mjs"
45
35
  }
46
36
  },
47
- "scripts": {
48
- "build": "bun run clean && turbo run build-next-font && turbo run build-src",
49
- "clean": "bun run ./scripts/clean-dist.ts",
50
- "build-next-font": "bun run ./scripts/build-next-font.ts",
51
- "build-src": "bun run ./scripts/build-src.ts"
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "dependencies": {
41
+ "@node-rs/xxhash": "^1.7.6",
42
+ "esrap": "^2.2.3",
43
+ "oxc-parser": "^0.116.0"
52
44
  },
53
45
  "devDependencies": {
46
+ "@capsizecss/metrics": "^3.6.2",
47
+ "@oxc-project/types": "^0.116.0",
48
+ "@rolldown/pluginutils": "^1.0.0-rc.7",
49
+ "@types/estree": "^1.0.8",
54
50
  "@types/fontkit": "^2.0.8",
55
- "fontkit": "^2.0.4"
51
+ "acorn": "^8.16.0",
52
+ "estree-walker": "^3.0.3",
53
+ "fontkit": "^2.0.4",
54
+ "rolldown": "^1.0.0-rc.7",
55
+ "rollup": "^4.59.0",
56
+ "stable-hash": "^0.0.6",
57
+ "vite": "8.0.0-beta.18",
58
+ "vite-rollup": "npm:vite@7.3.1",
59
+ "rollxxx": "0.0.1-beta.0"
56
60
  },
57
- "publishConfig": {
58
- "access": "public"
59
- },
60
- "repository": {
61
- "type": "git",
62
- "url": "git+https://github.com/kijv/next-font.git",
63
- "directory": "packages/next-font"
61
+ "scripts": {
62
+ "build": "tsdown --minify",
63
+ "dev": "tsdown --watch --sourcemap"
64
64
  }
65
- }
65
+ }
package/README.md DELETED
@@ -1,51 +0,0 @@
1
- ## Next Font
2
-
3
- Derived from `@next/font`. Aimed to be used in conjunction with [@next-font/plugin- vite](https://npmjs.com/package/@next-font/plugin-vite)
4
-
5
- > This package is best used with the [@next-font/plugin-vite](https://npmjs.com/package/@next-font/plugin-vite) package or any plugins under the [@next-font](https://npmjs.com/org/next-font) organization.
6
-
7
- ### Install
8
-
9
- ```
10
- npm install next-font
11
- ```
12
-
13
- ### Usage
14
-
15
- Exact same usage as `next/font`/`@next/font`.
16
-
17
- A example using google fonts:
18
-
19
- ```jsx
20
- import { Inter } from 'next-font/google'
21
-
22
- const inter = Inter({
23
- subsets: ['latin']
24
- }) // { className: '...' }
25
- ```
26
-
27
- An example using local fonts:
28
-
29
- ```js
30
- import localFont from 'next-font/local'
31
-
32
- const myFont = localFont({
33
- src: './my-font.woff2'
34
- }) // { className: '...' }
35
- ```
36
-
37
- This package also supports accessing the manifest, which contains per-file font information. This can be useful for generating preload or preconnect tags in the `<head>` of your HTML document.
38
-
39
- ```js
40
- import nextFontManifest from 'next-font/manifest';
41
-
42
- // raw manifest
43
- const manifest = nextFontManifest.manifest;
44
-
45
- // get fonts with preload enabled
46
- const preloadableFonts = nextFontManifest.getPreloadableFonts(someFilePath /* ex. import.meta.url */);
47
- // or skip accessing preloadableFonts and get data for <head>
48
- const metadata = nextFontManifest.getFontMetadata(someFilePath /* ex. import.meta.url */);
49
- ```
50
-
51
- See the Next.js [API Page](https://nextjs.org/docs/app/api-reference/components/font) for more options.
@@ -1 +0,0 @@
1
- function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(e,t,r,n){var o,c=arguments.length,f=c<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(f=(c<3?o(f):c>3?o(t,r,f):o(t,r))||f);return c>3&&f&&Object.defineProperty(t,r,f),f}export{t as _,e as a};
@@ -1,3 +0,0 @@
1
- declare const allowedDisplayValues: string[];
2
-
3
- export { allowedDisplayValues };
package/dist/constants.js DELETED
@@ -1 +0,0 @@
1
- let l=["auto","block","swap","fallback","optional"];export{l as allowedDisplayValues};
package/dist/fontkit.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { create } from 'fontkit';
2
- export { create as default } from 'fontkit';