@visulima/rollup-plugin-css 1.0.0-alpha.55 → 1.0.0-alpha.57
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/CHANGELOG.md +14 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/loaders/less/index.d.ts +5 -5
- package/dist/loaders/less/index.js +1 -1
- package/dist/loaders/lightningcss.d.ts +5 -5
- package/dist/loaders/lightningcss.js +3 -3
- package/dist/loaders/postcss/index.d.ts +5 -5
- package/dist/loaders/postcss/index.js +5 -5
- package/dist/loaders/sass/index.d.ts +6 -6
- package/dist/loaders/sass/index.js +6 -6
- package/dist/loaders/sourcemap.d.ts +5 -5
- package/dist/loaders/sourcemap.js +1 -1
- package/dist/loaders/stylus/index.d.ts +6 -6
- package/dist/loaders/stylus/index.js +2 -2
- package/dist/loaders/tailwindcss-oxide.d.ts +5 -5
- package/dist/loaders/tailwindcss-oxide.js +1 -1
- package/dist/minifiers/cssnano.d.ts +5 -5
- package/dist/minifiers/lightningcss.d.ts +5 -5
- package/dist/minifiers/lightningcss.js +2 -2
- package/dist/packem_shared/arrayFmt-e_AFKxNC.js +1 -0
- package/dist/packem_shared/browserslist-targets-1qnKWhAS.js +1 -0
- package/dist/packem_shared/concat-DpBhQ_1z.js +3 -0
- package/dist/packem_shared/cssModulesTypesPlugin-BfUMo77K.js +10 -0
- package/dist/packem_shared/detect-css-modules-Wp-6Pge4.js +1 -0
- package/dist/packem_shared/ensure-auto-modules-C1J_UELI.js +1 -0
- package/dist/packem_shared/ensurePCSSOption-BkLq8-iV.js +1 -0
- package/dist/packem_shared/generate-js-exports-CsMjsr8I.js +18 -0
- package/dist/packem_shared/{getMap-ChLH82qb.js → getMap-CJ3gOraV.js} +1 -1
- package/dist/packem_shared/getUrlOfPartial-BdjQe1Mg.js +1 -0
- package/dist/packem_shared/loadModule-_BdeIlVN.js +1 -0
- package/dist/packem_shared/resolve-DLQikOnx.js +4 -0
- package/dist/packem_shared/rollupCssPlugin-mpHmD0Ql.js +3 -0
- package/dist/packem_shared/safeId-BOlFTmJx.js +1 -0
- package/dist/packem_shared/sourcemap-DrC64huR.js +3 -0
- package/dist/packem_shared/{types.d-6pp-2OqA.d.ts → types.d-DbmFO7y3.d.ts} +65 -65
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.js +1 -1
- package/package.json +4 -4
- package/dist/packem_shared/arrayFmt-Dek5cB7m.js +0 -1
- package/dist/packem_shared/browserslist-targets-Bf0-yekJ.js +0 -1
- package/dist/packem_shared/concat-D-keMgEe.js +0 -3
- package/dist/packem_shared/cssModulesTypesPlugin-BAA7NENp.js +0 -10
- package/dist/packem_shared/detect-css-modules-ChgG1piw.js +0 -1
- package/dist/packem_shared/ensure-auto-modules-CCI2Jajb.js +0 -1
- package/dist/packem_shared/generate-js-exports-BKVXW192.js +0 -18
- package/dist/packem_shared/hasModuleSpecifier-DKQ_-lwa.js +0 -1
- package/dist/packem_shared/inferModeOption-D5fRQduB.js +0 -1
- package/dist/packem_shared/loadModule-DYNNk5sK.js +0 -1
- package/dist/packem_shared/resolve-D5Aw9ctO.js +0 -4
- package/dist/packem_shared/rollupCssPlugin-D2oNvLjv.js +0 -3
- package/dist/packem_shared/safeId-BN5akJYJ.js +0 -1
- package/dist/packem_shared/sourcemap-DpWa6ejr.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{stat as y}from"node:fs/promises";import{optimize as J,compile as M,toSourceMap as P,Features as a}from"@tailwindcss/node";import{clearRequireCache as $}from"@tailwindcss/node/require-cache";import{Scanner as A}from"@tailwindcss/oxide";import{findPackageJson as R}from"@visulima/package";import{join as S,normalize as E,resolve as w,dirname as v,relative as U}from"@visulima/path";import{resolveAlias as x}from"@visulima/path/utils";import{g as T}from"../packem_shared/generate-js-exports-CsMjsr8I.js";import{resolve as z}from"../packem_shared/resolve-DLQikOnx.js";const k=/\?[^?]*$/u,j=/[#?][^#?]*\.svg$/u,F=a.AtApply|a.JsPluginCompat|a.ThemeFunction|a.Utilities,d=(p,r)=>(p&r)!==0;class B{constructor(r,o,u,g,m,i){this.id=r,this.base=o,this.enableSourceMaps=u,this.customCssResolver=g,this.customJsResolver=m,this.logger=i}id;base;enableSourceMaps;customCssResolver;customJsResolver;logger;compiler;scanner;candidates=new Set;buildDependencies=new Map;async generate(r,o){const u=w(this.id.replace(k,"")),g=e=>{e!==u&&(j.test(e)||o(e))},m=this.requiresBuild(),i=v(w(u));if(!this.compiler||!this.scanner||await m){$([...this.buildDependencies.keys()]),this.buildDependencies.clear(),await this.addBuildDependency(u),this.logger.debug({message:"Setup compiler"});const e=[];this.compiler=await M(r,{base:i,customCssResolver:this.customCssResolver,customJsResolver:this.customJsResolver,from:this.enableSourceMaps?this.id:void 0,onDependency:c=>{g(c),e.push(this.addBuildDependency(c))},shouldRewriteUrls:!0}),await Promise.all(e),this.logger.debug({message:"Setup scanner"});const s=[...this.compiler.root==="none"?[]:this.compiler.root===null?[{base:this.base,negated:!1,pattern:"**/*"}]:[{...this.compiler.root,negated:!1}],...this.compiler.sources];this.scanner=new A({sources:s})}else for(const e of this.buildDependencies.keys())g(e);const l=d(this.compiler.features,F);if(this.logger.debug({data:{availableFeatures:this.compiler.features,hasAtApply:d(this.compiler.features,a.AtApply),hasJsPluginCompat:d(this.compiler.features,a.JsPluginCompat),hasRequiredFeatures:l,hasThemeFunction:d(this.compiler.features,a.ThemeFunction),hasUtilities:d(this.compiler.features,a.Utilities),requiredFeatures:F},message:"Feature analysis"}),!l)return this.logger.debug({data:{missingFeatures:{AtApply:!d(this.compiler.features,a.AtApply),JsPluginCompat:!d(this.compiler.features,a.JsPluginCompat),ThemeFunction:!d(this.compiler.features,a.ThemeFunction),Utilities:!d(this.compiler.features,a.Utilities)}},message:"Missing required features, returning false"}),!1;if(d(this.compiler.features,a.Utilities)){const{scanner:e}=this;this.logger.debug({data:{candidatesCountBefore:this.candidates.size,scannerHasScan:typeof e.scan=="function"},message:"Scan for candidates - Utilities feature enabled"});const s=e.scan();this.logger.debug({data:{scannedCandidates:s.slice(0,10),scannedCandidatesCount:s.length},message:"Scanner results"});for(const c of s)this.candidates.add(c);this.logger.debug({data:{candidatesCountAfter:this.candidates.size,newCandidatesAdded:s.length},message:"Candidates updated"})}else this.logger.debug({message:"Utilities feature not enabled, skipping candidate scanning"});if(d(this.compiler.features,a.Utilities)){const{scanner:e}=this;this.logger.debug({data:{files:e.files.slice(0,5),filesCount:e.files.length},message:"Watching individual files from scanner"});for(const s of e.files)g(s);this.logger.debug({data:{globs:e.globs.slice(0,3),globsCount:e.globs.length},message:"Processing globs from scanner"});for(const s of e.globs){if(s.pattern[0]==="!"){this.logger.debug({data:{pattern:s.pattern},message:"Skipping negated glob pattern"});continue}let c=U(this.base,s.base);c[0]!=="."&&(c=`./${c}`);const C=S(c,s.pattern);this.logger.debug({data:{base:s.base,glob:s.pattern,watchPath:C},message:"Adding glob to watch list"}),g(C);const{root:b}=this.compiler;if(b!=="none"&&b!==null){const f=w(b.base,b.pattern);try{const h=await y(f);if(h.isDirectory())this.logger.debug({data:{basePath:f,isDirectory:h.isDirectory()},message:"Valid source directory confirmed"});else{const D=`The path given to \`source(…)\` must be a directory but got \`source(${f})\` instead.`;throw this.logger.debug({data:{basePath:f,error:D,isDirectory:h.isDirectory()},message:"Invalid source path detected"}),new Error(D)}}catch(h){this.logger.debug({data:{basePath:f,error:h instanceof Error?h.message:String(h)},message:"Error checking source directory"})}}}}else this.logger.debug({message:"Utilities feature not enabled, skipping file watching"});this.logger.debug({data:{candidates:[...this.candidates].slice(0,10),candidatesCount:this.candidates.size},message:"Build CSS"});const t=this.compiler.build([...this.candidates]);this.logger.debug({data:{cssLength:t.length,cssPreview:t.slice(0,200)+(t.length>200?"...":"")},message:"CSS build completed"}),this.logger.debug({data:{enableSourceMaps:this.enableSourceMaps},message:"Build Source Map"});const n=(this.enableSourceMaps?P(this.compiler.buildSourceMap()):void 0)?.raw;if(n){const e=n;this.logger.debug({data:{hasMappings:!!e.mappings,mapSize:JSON.stringify(n).length,sourcesCount:e.sources?.length??0},message:"Source map generated"})}else this.logger.debug({message:"No source map generated"});return{code:t,map:n}}async addBuildDependency(r){let o;try{o=(await y(r)).mtimeMs}catch{}this.buildDependencies.set(r,o)}async requiresBuild(){for(const[r,o]of this.buildDependencies){if(o===void 0)return!0;try{if((await y(r)).mtimeMs>o)return!0}catch{return!0}}return!1}}const W={name:"tailwindcss",async process({code:p,map:r}){const o=this.alias,u=async(t,n)=>{try{const e=await R(n),s=z([t,x(t,o??{})],{baseDirs:[n,S(v(e.path),"node_modules")],caller:"Tailwind CSS Resolver",conditionNames:["style","development|production"],extensions:[".css"],mainFields:["style"],preferRelative:!0});if(s)return this.logger.debug({message:`Resolved CSS import: ${t} -> ${s}`}),s}catch{}return this.logger.debug({message:`Failed to resolve CSS import: ${t} from ${n}`}),!1},g=async(t,n)=>{try{const e=await R(n),s=z([t,x(t,o??{})],{baseDirs:[n,S(v(e.path),"node_modules")],caller:"Tailwind JS Resolver",extensions:[".js",".mjs",".cjs",".ts",".tsx",".jsx"]});if(s)return this.logger.debug({message:`Resolved JS import: ${t} -> ${s}`}),s}catch{}return this.logger.debug({message:`Failed to resolve JS import: ${t} from ${n}`}),!1};let m;this.cwd?m=this.sourceDir?S(this.cwd,this.sourceDir):this.cwd:m=this.sourceDir??process.cwd();let i=await new B(this.id,m,this.useSourcemap,u,g,this.logger).generate(p,t=>this.deps.add(E(t)));if(!i)return this.logger.debug({data:{returningOriginalContent:!0},message:"Tailwind generation returned false - not a Tailwind file or missing features"}),{code:p,map:r};if(this.logger.debug({message:"[@tailwindcss/rollup] Generate CSS"}),this.environment==="production"){this.logger.debug({data:{minify:!0,originalSize:i.code.length},message:"[@tailwindcss/rollup] Optimize CSS"});const t=J(i.code,{file:this.id,map:i.map,minify:!0});this.logger.debug({data:{optimizedSize:t.code.length,originalSize:i.code.length,sizeReduction:i.code.length-t.code.length,sizeReductionPercent:`${((i.code.length-t.code.length)/i.code.length*100).toFixed(2)}%`},message:"CSS optimization completed"}),i=t}else this.logger.debug({data:{environment:this.environment},message:"Development mode - skipping CSS optimization"});if(this.emit)return{...i,meta:{moduleContents:i,types:void 0},moduleSideEffects:!0};const l=T({css:i.code,cwd:this.cwd,dts:this.dts,emit:this.emit,extract:this.extract,icssDependencies:[],id:this.id,inject:this.inject,inline:this.inline,logger:this.logger,map:i.map,modulesExports:{},namedExports:this.namedExports,supportModules:!1});return this.extract?{code:l.code,extracted:{css:i.code,id:this.id,map:i.map},map:l.map,meta:l.meta,moduleSideEffects:l.moduleSideEffects}:{code:l.code,map:l.map,meta:l.meta,moduleSideEffects:l.moduleSideEffects}},test:/\.css$/i};export{W as default};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Options } from 'cssnano';
|
|
2
|
-
import { M as Minifier } from "../packem_shared/types.d-
|
|
3
|
-
import '@visulima/packem-share/utils';
|
|
4
|
-
import '@visulima/packem-share/types';
|
|
5
|
-
import 'rollup';
|
|
6
|
-
import 'source-map-js';
|
|
2
|
+
import { M as Minifier } from "../packem_shared/types.d-DbmFO7y3.js";
|
|
7
3
|
import 'lightningcss';
|
|
8
4
|
import 'postcss';
|
|
9
5
|
import 'postcss-load-config';
|
|
6
|
+
import '@visulima/packem-share/types';
|
|
10
7
|
import 'sass';
|
|
11
8
|
import 'sass-embedded';
|
|
12
9
|
import 'stylus';
|
|
10
|
+
import '@visulima/packem-share/utils';
|
|
11
|
+
import 'rollup';
|
|
12
|
+
import 'source-map-js';
|
|
13
13
|
declare const cssnanoMinifier: Minifier<Options>;
|
|
14
14
|
export { cssnanoMinifier as default };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { I as InternalStyleOptions, M as Minifier } from "../packem_shared/types.d-
|
|
2
|
-
import '@visulima/packem-share/utils';
|
|
3
|
-
import '@visulima/packem-share/types';
|
|
4
|
-
import 'rollup';
|
|
5
|
-
import 'source-map-js';
|
|
1
|
+
import { I as InternalStyleOptions, M as Minifier } from "../packem_shared/types.d-DbmFO7y3.js";
|
|
6
2
|
import 'cssnano';
|
|
7
3
|
import 'lightningcss';
|
|
8
4
|
import 'postcss';
|
|
9
5
|
import 'postcss-load-config';
|
|
6
|
+
import '@visulima/packem-share/types';
|
|
10
7
|
import 'sass';
|
|
11
8
|
import 'sass-embedded';
|
|
12
9
|
import 'stylus';
|
|
10
|
+
import '@visulima/packem-share/utils';
|
|
11
|
+
import 'rollup';
|
|
12
|
+
import 'source-map-js';
|
|
13
13
|
declare const lightningcssMinifier: Minifier<NonNullable<InternalStyleOptions["lightningcss"]>>;
|
|
14
14
|
export { lightningcssMinifier as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{transform as
|
|
2
|
-
${s.warnings.map(
|
|
1
|
+
import{transform as i}from"lightningcss";import{g as o}from"../packem_shared/browserslist-targets-1qnKWhAS.js";const g={handler(e,r,n){const s=i({...n,code:Buffer.from(e.css),cssModules:void 0,filename:e.name,inputSourceMap:e.map,minify:!0,sourceMap:!!r,targets:o(this.browserTargets)});return s.warnings.length>0&&this.logger.warn({message:`warnings when minifying css:
|
|
2
|
+
${s.warnings.map(a=>a.message).join(`
|
|
3
3
|
`)}`}),Promise.resolve({...e,css:s.code.toString(),map:"map"in s?s.map?.toString():void 0})},name:"lightningcss"};export{g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const s=n=>n.map((r,a,e)=>{const t=`\`${r}\``;switch(a){case e.length-1:return`or ${t}`;case e.length-2:return t;default:return`${t},`}}).join(" ");export{s as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{browserslistToTargets as s}from"lightningcss";const o=new Map,g=e=>{const r=e.join(",");let t=o.get(r);return t||(t=s(e),o.set(r,t)),t};export{g};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{SourceMapGenerator as l}from"source-map-js";import{m as p}from"./sourcemap-DrC64huR.js";const C=m=>{const o=new l({file:""}),s=[];let i=0;for(const{css:a,map:u}of m){s.push(a);const c=p(u),r=c.toObject();if(r){const t=c.toConsumer();if(t&&(t.eachMapping(e=>{const n={generated:{column:e.generatedColumn,line:i+e.generatedLine}};typeof e.originalLine=="number"&&typeof e.originalColumn=="number"&&typeof e.source=="string"&&(n.original={column:e.originalColumn,line:e.originalLine},n.source=e.source,typeof e.name=="string"&&(n.name=e.name)),o.addMapping(n)}),r.sourcesContent))for(const e of r.sources)o.setSourceContent(e,t.sourceContentFor(e,!0))}i+=a.split(`
|
|
2
|
+
`).length}return Promise.resolve({css:s.join(`
|
|
3
|
+
`),map:o})};export{C as default};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{isAccessible as m,readFile as r,writeFile as d}from"@visulima/fs";import{normalize as u}from"@visulima/path";import{o as l}from"./ensure-auto-modules-C1J_UELI.js";const g=`
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/* prettier-ignore */
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
/**
|
|
6
|
+
* Generated by packem
|
|
7
|
+
* @see https://npmjs.com/@visulima/packem
|
|
8
|
+
*/
|
|
9
|
+
`.trim(),$=(s,p)=>{let e;return s.postcss&&typeof s.postcss.modules=="boolean"?e=s.postcss.modules:s.lightningcss&&typeof s.lightningcss.modules=="boolean"&&(e=s.lightningcss.modules),{name:"css-modules-types",async transform(f,t){let o=e;if(s.postcss&&typeof s.postcss.modules=="object"?o=l(s.postcss.modules.include,t):s.lightningcss&&typeof s.lightningcss.modules=="object"&&(o=l(s.lightningcss.modules.include,t)),s.autoModules&&o===void 0&&(o=l(s.autoModules,t)),!o)return;const n=this.getModuleInfo(t)?.meta.styles?.types;if(n!==void 0&&await m(t)){const i=`${t}.d.ts`,c=`${g}
|
|
10
|
+
${n}`;let a;await m(i)&&(a=await r(i)),a!==c&&(await d(i,c),this.info({message:`Generated types for ${u(t).replace(`${p}/`,"")}`,plugin:"css-modules-types"}))}}}};export{$ as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as f}from"./ensure-auto-modules-C1J_UELI.js";const c=(o,t,e)=>typeof o=="boolean"?o:typeof o=="object"?f(o.include,e):t?f(t,e):!1;export{c as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=/\.module\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/i,c=(s,t)=>s===void 0?!0:typeof s=="function"?s(t):s instanceof RegExp?s.test(t):s&&o.test(t);export{c as o};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import p from"./arrayFmt-e_AFKxNC.js";import u from"./loadModule-_BdeIlVN.js";const c=["inject","extract","emit","inline"],f=p(c),g=(t,i)=>{const n=Array.isArray(t)?t:[t];if(n[0]&&!c.includes(n[0]))throw new Error(`Incorrect mode provided, allowed modes are ${f}`);const r=n[0]??"inject";let e=!1,o=!1;return r==="extract"&&(e=n[1]??!0),r==="inject"&&(o=n[1]??!0),(r==="emit"||r==="inline")&&n[1]!==void 0&&i?.warn({message:`The "${r}" mode does not accept additional options; ignoring the provided tuple option.`,plugin:"css"}),{emit:r==="emit",extract:e,inject:o,inline:r==="inline"}},d=(t,i)=>typeof t=="boolean"?t&&{}:typeof t=="object"?t:i,w=t=>{const i=Array.isArray(t)?t:[t];return i[0]?{content:!0,...i[1],inline:i[0]==="inline"}:!1},h=(t,i)=>{const n=d(t,{});return i&&typeof n=="object"&&!n.alias&&(n.alias=i),n},a=async(t,i,n,r)=>{if(typeof t!="string")return t;const e=await u(t,n,r);if(!e)throw new Error(`Unable to load PostCSS ${i} \`${t}\``);return e},S=async(t,i,n)=>{if(t===void 0)return[];if(t.length===0)return[];const r=[];for(const e of t.filter(Boolean)){if(!Array.isArray(e)){r.push(await a(e,"plugin",i,n));continue}const[o,s]=e;if(s){const l=await a(o,"plugin",i,n);r.push(l(s))}else r.push(await a(o,"plugin",i,n))}return r};export{a as ensurePCSSOption,S as ensurePCSSPlugins,h as inferHandlerOption,g as inferModeOption,d as inferOption,w as inferSourceMapOption};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{basename as S,relative as k}from"@visulima/path";import J from"./safeId-BOlFTmJx.js";const h="css",V=new Set(["arguments","await","break","case","catch","class","const","continue",h,"debugger","default","delete","do","else","enum","eval","export","extends","false","finally","for","function","if","implements","import","in","instanceof","interface","let","new","null","package","private","protected","public","return","static","super","switch","this","throw","true","try","typeof","var","void","while","with","yield"]),M=t=>{const s=t.replaceAll(/[^\w$]/g,"_");return V.has(s)?`_${s}`:s},D=({dts:t,dtsOutput:s,namedExports:e,output:o,outputExports:r})=>{if(!e)return;const n=`export {
|
|
2
|
+
${r.filter(Boolean).join(`,
|
|
3
|
+
`)}
|
|
4
|
+
};`;o.push(n),t&&s.push(n)},w=t=>`
|
|
5
|
+
interface ModulesExports {
|
|
6
|
+
${Object.keys(t).map(s=>` '${s.replaceAll("\\",String.raw`\\`).replaceAll("'",String.raw`\'`)}': string;`).join(`
|
|
7
|
+
`)}
|
|
8
|
+
}
|
|
9
|
+
`,A=({cssDeclared:t,cssVariableName:s,defaultExport:e,dtsOutput:o,inject:r,modulesExports:n,modulesVariableName:p,supportModules:u})=>{u?o.push(w(n),typeof r=="object"&&r.treeshakeable?"interface ModulesExports {inject:()=>void}":"",`declare const ${p}: ModulesExports;`):t||o.push(`declare const ${s}: string;`),o.push(e)},_=/^[$_a-z][\w$]*$/i,B=({cssVariableName:t,id:s,inject:e,modulesExports:o,modulesVariableName:r,output:n,saferId:p})=>{if(typeof e=="function"){n.push(e(t,s,n),`var ${r} = ${JSON.stringify(o)};`);return}const{treeshakeable:u,...l}=typeof e=="object"?e:{},f=p("injector"),d=`${f}(${t},${JSON.stringify(l)});`,i=typeof e=="object"&&e.package?e.package:"@visulima/css-style-inject",a=typeof e=="object"&&e.method?e.method:"cssStyleInject";if(typeof i!="string"||i.trim().length===0)throw new TypeError(`\`inject.package\` must be a non-empty string, received: ${JSON.stringify(i)}`);if(!_.test(a))throw new Error(`\`inject.method\` must be a valid JavaScript identifier, received: ${JSON.stringify(a)}`);if(n.unshift(`import { ${a} as ${f} } from "${i}";`),!u){n.push(`var ${r} = ${JSON.stringify(o)};`,d);return}n.push("var injected = false;");const c=`if (!injected) { injected = true; ${d} }`;if(o.inject)throw new Error("`inject` keyword is reserved when using `inject.treeshakeable` option");let g="";for(const[x,$]of Object.entries(o)){const m=JSON.stringify(x),y=JSON.stringify($);g+=`get ${m}() { ${c} return ${y}; },
|
|
10
|
+
`}g+=`inject: function inject() { ${c} },`,n.push(`var ${r} = {${g}};`)},v=({cwd:t,dts:s,dtsOutput:e,id:o,logger:r,modulesExports:n,namedExports:p,output:u,outputExports:l})=>{if(!p||Object.keys(n).length===0)return;const f=typeof p=="function"?p:M;for(const[d,i]of Object.entries(n)){const a=f(d);if(d!==a&&r){const g=t?k(t,o):o;r.warn({message:`Exported \`${d}\` as \`${a}\` in ${g}`})}const c=JSON.stringify(i);u.push(`var ${a} = ${c};`),s&&e.push(`declare const ${a}: ${c};`),l?.push(a)}},C=({css:t,cssVariableName:s,cwd:e,dts:o,dtsOutput:r,id:n,logger:p,modulesExports:u,modulesVariableName:l,namedExports:f,supportModules:d})=>{const i=[`var ${s} = ${JSON.stringify(t)};`];v({cwd:e,dts:o,dtsOutput:r,id:n,logger:p,modulesExports:u,namedExports:f,output:i}),Object.keys(u).length>0&&i.push(`var ${l} = ${JSON.stringify(u)};`);const a=`
|
|
11
|
+
export default ${d?l:s};
|
|
12
|
+
`;return i.push(a),o&&(r.push(`declare const ${s}: string;`),d&&r.push(w(u),`declare const ${l}: ModulesExports;`),r.push(a)),{code:i.join(`
|
|
13
|
+
`),moduleSideEffects:!1,types:o?r.join(`
|
|
14
|
+
`):void 0}},R=({css:t,cwd:s,dts:e=!1,emit:o=!1,extract:r=!1,icssDependencies:n=[],id:p,inject:u,inline:l=!1,logger:f,map:d,modulesExports:i,namedExports:a,supportModules:c})=>{const g=N=>J(N,S(p)),x=g("modules"),$=[`var ${h} = ${JSON.stringify(t)};`],m=[],y=[h];if(a&&(e&&m.push(`declare const ${h}: string;`),v({cwd:s,dts:e,dtsOutput:m,id:p,logger:f,modulesExports:i,namedExports:a,output:$,outputExports:y})),l)return C({css:t,cssVariableName:h,cwd:s,dts:e,dtsOutput:m,id:p,logger:f,modulesExports:i,modulesVariableName:x,namedExports:a,supportModules:c});u&&B({cssVariableName:h,id:p,inject:u,modulesExports:i,modulesVariableName:x,output:$,saferId:g}),!u&&Object.keys(i).length>0&&$.push(`var ${x} = ${JSON.stringify(i)};`);const E=`
|
|
15
|
+
export default ${c?x:h};
|
|
16
|
+
`;$.push(E),e&&A({cssDeclared:!!a,cssVariableName:h,defaultExport:E,dtsOutput:m,inject:u,modulesExports:i,modulesVariableName:x,supportModules:c}),D({dts:e,dtsOutput:m,namedExports:a,output:$,outputExports:y});const j=$.filter(Boolean).join(`
|
|
17
|
+
`),b=m.length>0?m.filter(Boolean).join(`
|
|
18
|
+
`):void 0;if(o)return{code:t,map:d,meta:{icssDependencies:n,moduleContents:j,types:void 0},moduleSideEffects:!0};let O;return r&&(O={css:t,id:p,map:d}),{code:j,extracted:O,map:d,meta:{icssDependencies:n,moduleContents:j,types:b},moduleSideEffects:c||typeof u=="object"&&u.treeshakeable?!1:"no-treeshake",types:b}};export{R as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"@visulima/fs";import"@visulima/path";import"source-map-js";import{g as o,m as s,s as i}from"./sourcemap-
|
|
1
|
+
import"@visulima/fs";import"@visulima/path";import"source-map-js";import{g as o,m as s,s as i}from"./sourcemap-DrC64huR.js";export{o as getMap,s as mm,i as stripMap};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parse as s,normalize as r,isAbsolute as a}from"@visulima/path";import{isRelative as l}from"@visulima/path/utils";const t=/^~[\d@A-Z]/i,m=e=>t.test(e),p=e=>{const{base:i,dir:o}=s(e);return o?`${r(o)}/_${i}`:`_${i}`},f=e=>m(e)?r(e.slice(1)):a(e)||l(e)?r(e):`./${r(e)}`;export{p as getUrlOfPartial,m as hasModuleSpecifier,f as normalizeUrl};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as c}from"node:module";import{interopDefault as m,loadModule as d}from"mlly";import{resolve as f}from"./resolve-DLQikOnx.js";const s=new Map,p=[".js",".mjs",".cjs",".json"],g=async(t,o)=>{try{return o(t)}catch(a){const e=a;if(e.code==="ERR_REQUIRE_ESM")return m(await d(t));throw e}},y=async(t,o,a)=>{const e=`${o}\0${t}`;if(s.has(e)){const r=s.get(e);if(r===null)return;const l=r;return l?.default??l}const u={baseDirs:[o],caller:"Module loader",extensions:p,symlinks:!1},i=c(import.meta.url);try{const r=f([t,`./${t}`],u);if(r.startsWith("data:")){a.warn({message:`Skipping data URL module: ${t}`,module:t,plugin:"css"}),s.set(e,null);return}s.set(e,await g(r,i))}catch(r){a.warn({message:`Failed to resolve or load module: ${r instanceof Error?r.message:String(r)}`,module:t,plugin:"css"}),s.set(e,null);return}const n=s.get(e);return n?.default??n};export{y as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{fileURLToPath as f}from"node:url";import{dirname as $}from"@visulima/path";import{ResolverFactory as g}from"oxc-resolver";import c from"./arrayFmt-e_AFKxNC.js";const p=$(f(import.meta.url)),m=new Map,u=(n,e)=>{const r=JSON.stringify({extensions:n,symlinks:e});let o=m.get(r);return o||(o=new g({extensions:n,symlinks:e}),m.set(r,o)),o},y=(n,e,r,o)=>{try{const{error:s,path:t}=n.sync(e,r);if(t)return t;s&&o.push(`"${r}" from "${e}": ${s}`)}catch(s){const t=s instanceof Error?s.message:String(s);o.push(`"${r}" from "${e}": ${t}`)}},x=(n,e)=>{const r={baseDirs:[p],caller:"Resolver",extensions:[".mjs",".js",".cjs",".json"],symlinks:!0,...e},o=u(r.extensions,r.symlinks),s=[];for(const i of r.baseDirs)for(const a of n){const l=y(o,i,a,s);if(l)return l}const t=s.length>0?`
|
|
2
|
+
Tried:
|
|
3
|
+
${s.map(i=>` - ${i}`).join(`
|
|
4
|
+
`)}`:"";throw e.logger&&s.length>0&&e.logger.debug?.({message:`${r.caller} could not resolve ${c(n)}.${t}`}),new Error(`${r.caller} could not resolve ${c(n)}.${t}`)};export{x as resolve};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{createFilter as X}from"@rollup/pluginutils";import{createRollupLogger as Y}from"@visulima/packem-share/utils";import{dirname as k,normalize as z,basename as G,join as H,parse as R,isAbsolute as ee,relative as U,resolve as se}from"@visulima/path";import{isRelative as te}from"@visulima/path/utils";import oe from"p-queue";import ie from"./concat-DpBhQ_1z.js";import{inferSourceMapOption as ne,inferModeOption as V,inferHandlerOption as W,inferOption as Z,ensurePCSSOption as T,ensurePCSSPlugins as re}from"./ensurePCSSOption-BkLq8-iV.js";import{m as q}from"./sourcemap-DrC64huR.js";const B=(e,n)=>{if(!n)return!1;if(typeof n=="function")return n(e);if(typeof n.test=="function")return n.test(e);throw new Error("Invalid condition type")},ae=4,_=process.env.UV_THREADPOOL_SIZE?Number.parseInt(process.env.UV_THREADPOOL_SIZE,10):Number.NaN,ce=Number.isFinite(_)&&_>0?_:ae,le=Math.max(1,ce-1);class de{test;loaders=new Map;options;workQueue;logger;constructor({extensions:n,loaders:d,logger:y,options:N}){this.test=S=>{const x=S.toLowerCase();return n.some(F=>x.endsWith(F))},d.length>0&&this.add(...d),this.options=N,this.logger=y}add(...n){for(const d of n)this.loaders.has(d.name)||this.loaders.set(d.name,d)}isSupported(n){if(this.test(n))return!0;for(const[,d]of this.loaders)if(B(n,d.test))return!0;return!1}async process(n,d){this.workQueue??=new oe({concurrency:le});for(const[y,N]of this.loaders){const S={...d,options:this.options[y]??{}};if(N.alwaysProcess||B(S.id,N.test)){this.logger.debug({message:`Processing ${y} loader for ${S.id}`,plugin:"css"});try{const x=await this.workQueue.add(N.process.bind(S,n));n={...x,extracted:x.extracted??n.extracted,meta:x.meta??n.meta},this.logger.debug({message:`Completed ${y} loader for ${S.id}`,outputSize:x.code.length,plugin:"css"})}catch(x){throw this.logger.error({file:S.id,loader:y,message:`Error in ${y} loader for ${S.id}: ${x instanceof Error?x.message:String(x)}`,plugin:"css"}),x}}}return n}}const pe=/^\.[/\\]/,ue=/\S/,fe=(e,n)=>e.toSorted((d,y)=>n.indexOf(d.name)-n.indexOf(y.name)),be=(e,n,d,y,N,S,x,F,J)=>{const j={...J,...e.alias},Q=X(e.include,e.exclude),$=ne(e.sourceMap),o={...V(e.mode),autoModules:e.autoModules??!1,dts:e.dts,extensions:e.extensions,namedExports:e.namedExports};let c,I,D=!1;if(e.loaders)for(const t of e.loaders)t.name==="postcss"&&(D=!0);else e.loaders=[];D&&(o.postcss={...e.postcss,config:Z(e.postcss?.config,{}),import:W(e.postcss?.import,j),modules:Z(e.postcss?.modules,void 0),to:e.postcss?.to,url:W(e.postcss?.url,j)});const M=new Map,C=(t,f)=>{const m=[];for(const r of Object.keys(t)){const a=new Set;let g=[r];do{const v=[];for(const h of g){if(a.has(h))continue;if(I.isSupported(h)){Q(h)&&v.push(h);continue}a.add(h);const O=f(h);O&&v.push(...O.importedIds)}g=v}while(g.some(v=>!I.isSupported(v)));m.push(...g)}return m};return{augmentChunkHash(t){if(M.size===0)return;const f=C(t.modules,this.getModuleInfo),m=new Map;f.forEach((a,g)=>m.set(a,g));const r=[...M.values()].filter(a=>m.has(a.id)).toSorted((a,g)=>m.get(a.id)-m.get(g.id)).map(a=>`${G(a.id)}:${a.css}`);if(r.length!==0)return r.join(":")},async buildStart(){M.clear(),c=Y(this,"css"),V(e.mode,c),D&&o.postcss&&(e.postcss?.parser&&(o.postcss.parser=await T(e.postcss.parser,"parser",d,c)),e.postcss?.syntax&&(o.postcss.syntax=await T(e.postcss.syntax,"syntax",d,c)),e.postcss?.stringifier&&(o.postcss.stringifier=await T(e.postcss.stringifier,"stringifier",d,c)),e.postcss?.plugins&&(o.postcss.plugins=await re(e.postcss.plugins,d,c))),I=new de({extensions:o.extensions,loaders:fe(e.loaders??[],["sourcemap","stylus","less","sass","postcss"]),logger:c,options:{...e,...o,alias:j}}),c.info({extract:typeof o.extract=="string"?o.extract:"individual",loaders:e.loaders?.map(t=>t.name)??[],message:"CSS plugin initialized",minify:!!(F&&e.minifier),namedExports:!!o.namedExports,plugin:"css",sourceMap:S}),typeof o.inject=="object"&&o.inject.treeshakeable&&(o.namedExports=!1,c.info({message:"Disabling named exports due to `inject.treeshakeable` option",plugin:"css"}))},async generateBundle(t,f){if(M.size===0||!(t.dir||t.file))return;const m=Object.values(f),r=t.dir??k(t.file),a=m.filter(i=>i.type==="chunk"),g=a.filter(i=>!i.facadeModuleId),v=t.preserveModules?a:a.filter(i=>i.isEntry||i.isDynamicEntry),h=[],O=async(i,u)=>{const s=typeof o.extract=="string"?z(o.extract).replace(pe,""):z(`${i}.css`);ee(s)&&this.error(["Extraction path must be relative to the output directory,",`which is ${U(d,r)}`].join(`
|
|
2
|
+
`)),te(s)&&this.error(["Extraction path must be nested inside output directory,",`which is ${U(d,r)}`].join(`
|
|
3
|
+
`));const p=new Map;u.forEach((w,l)=>p.set(w,l));const E=[...M.values()].filter(w=>p.has(w.id)).toSorted((w,l)=>p.get(w.id)-p.get(l.id)),b=await ie(E);return{css:b.css,map:q(b.map.toString()).relative(k(se(r,s))).toString(),name:s}},L=i=>{if(t.file)return R(t.file).name;if(t.preserveModules){const{dir:u,name:s}=R(i.fileName);return u?H(u,s):s}return i.name},P=new Set;if(typeof o.extract=="string"){c.debug({message:`Extracting to ${o.extract}`,prefix:"css"});const i=[];for(const s of g){const p=C(s.modules,this.getModuleInfo);for(const E of p)P.add(E);i.push(...p)}for(const s of v)i.push(...C(s.modules,this.getModuleInfo).filter(p=>!P.has(p)));const u=L(a[0]);h.push([u,i])}else{c.debug({message:"Extracting to individual files",prefix:"css"});for(const i of g){const u=C(i.modules,this.getModuleInfo);if(u.length===0)continue;for(const p of u)P.add(p);const s=L(i);h.push([s,u])}for(const i of v){const u=C(i.modules,this.getModuleInfo).filter(p=>!P.has(p));if(u.length===0)continue;const s=L(i);h.push([s,u])}}for(const[i,u]of h){const s=await O(i,u);if(typeof e.onExtract=="function"&&!e.onExtract(s))continue;if(F&&e.minifier){c.info({message:`Minifying ${s.name} with ${e.minifier.name}`,prefix:"css"});const{css:E,map:b}=await e.minifier.handler.bind({browserTargets:n,logger:c})(s,$,e[e.minifier.name]??{});s.css=E,s.map=b}const p={fileName:s.name,name:s.name,names:[s.name],originalFileName:s.name,originalFileNames:[s.name],source:s.css,type:"asset"};if(s.map&&$){const E=s.name;let b="assets";typeof t.assetFileNames=="string"?b=z(k(t.assetFileNames)):typeof t.assetFileNames=="function"&&(b=z(k(t.assetFileNames(p))));const w=q(s.map).modify(l=>(l.file=G(E),l)).modifySources(l=>{if(l==="<no source>"||b.length<=1)return l;l=`../${l}`;for(const A of b)A==="/"&&(l=`../${l}`);return l});if($.inline)w.modify(l=>$.transform?.(l,z(H(r,E)))),p.source+=w.toCommentData(),c.debug({message:`Generated inline source map for ${E}`,plugin:"css"});else{const l=`${E}.map`;w.modify(K=>$.transform?.(K,z(H(r,l)))),this.emitFile({fileName:l,source:w.toString(),type:"asset"});const{base:A}=R(l);p.source+=w.toCommentFile(A),c.debug({message:`Generated external source map: ${l}`,plugin:"css"})}}this.emitFile(p),c.info({chunkIds:u.length,hasSourceMap:!!(s.map&&$),message:`Emitted CSS file: ${s.name}`,plugin:"css",size:p.source.length})}h.length>0&&c.info({filesEmitted:h.length,message:"CSS processing complete",plugin:"css",totalExtracted:M.size,totalSize:h.reduce((i,[,u])=>i+u.length,0)})},moduleParsed(t){const f=t.meta.extracted;f&&M.set(f.id,f)},name:"rollup-plugin-css",async transform(t,f){if(!Q(f)||!I.isSupported(f))return;if(!ue.test(t)){c.debug({message:`Skipping empty file: ${f}`,plugin:"css"});return}c.info({message:`Processing CSS file: ${f}`,plugin:"css",size:t.length}),typeof e.onImport=="function"&&e.onImport(t,f);const m={alias:j,assets:new Map,autoModules:o.autoModules,browserTargets:n,cwd:d,debug:x,deps:new Set,dts:o.dts,emit:o.emit,environment:N,extensions:o.extensions,extract:o.extract,id:f,inject:o.inject,inline:o.inline,logger:c,namedExports:o.namedExports,options:{},plugin:this,sourceDir:y,sourceMap:$,useSourcemap:S},r=await I.process({code:t},m);c.info({assets:m.assets.size,dependencies:m.deps.size,hasExtracted:!!r.extracted,message:`Processed ${f}`,outputSize:r.code.length,plugin:"css"});for(const a of m.deps)this.addWatchFile(a);for(const[a,g]of m.assets)this.emitFile({fileName:a,source:g,type:"asset"}),c.debug({message:`Emitted asset: ${a}`,plugin:"css",size:g.length});if(r.extracted){const{id:a}=r.extracted;M.set(a,r.extracted),c.debug({cssSize:r.extracted.css.length,hasSourceMap:!!r.extracted.map,message:`Extracted CSS from ${a}`,plugin:"css"})}return{code:r.code,map:$&&r.map?r.map:{mappings:""},meta:{extracted:r.extracted,styles:r.meta},moduleSideEffects:r.extracted?!0:void 0}}}};export{be as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{makeLegalIdentifier as t}from"@rollup/pluginutils";import{getHash as i}from"@visulima/packem-share/utils";const m=(e,...o)=>{const r=i([e,"0iOXBLSx",...o].join(":")).slice(0,8);return t(`${e}_${r}`)};export{m as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{isAccessibleSync as m,readFileSync as u}from"@visulima/fs";import{resolve as p,dirname as h,isAbsolute as f,relative as l,normalize as g}from"@visulima/path";import{SourceMapConsumer as S}from"source-map-js";const w=/\[hash(?::(\d+))?\]/,A=/(?<!^|[/\\])(\.[^\s.]+)/,d=/data:[^\n\r;]+(?:;charset=[^\n\r;]+)?;base64,([\d+/A-Za-z]+={0,2})/,o=/(?:\n|\r\n)?\/\*[#*@]+\s*sourceMappingURL\s*=\s*(\S+)\s*\*+\//g,a=/(?:\n|\r\n)?\/\/[#@]+\s*sourceMappingURL\s*=\s*(\S+)\s*/g;class E{map;constructor(s){if(typeof s=="string")try{this.map=JSON.parse(s)}catch{}else this.map=s}modify(s){return this.map?(s(this.map),this):this}modifySources(s){return this.map?(this.map.sources=this.map.sources.map(r=>s(r)),this):this}resolve(s=process.cwd()){return this.modifySources(r=>r==="<no source>"?r:p(s,r))}relative(s=process.cwd()){return this.modifySources(r=>r==="<no source>"?r:f(r)?l(s,r):g(r))}toObject(){return this.map}toString(){return this.map?JSON.stringify(this.map):this.map}toConsumer(){return this.map?new S(this.map):this.map}toCommentData(){const s=this.toString();return s?`
|
|
2
|
+
/*# sourceMappingURL=data:application/json;base64,${Buffer.from(s).toString("base64")} */`:""}toCommentFile(s){return this.map?`
|
|
3
|
+
/*# sourceMappingURL=${s} */`:""}}const x=(e,s)=>{const r=new RegExp(o.source,o.flags.replace("g","")),c=new RegExp(a.source,a.flags.replace("g","")),[,t]=r.exec(e)??c.exec(e)??[];if(!t)return;const[,i]=d.exec(t)??[];if(i)return Buffer.from(i,"base64").toString();if(!s)throw new Error("Extracted map detected, but no ID is provided");const n=p(h(s),t);if(m(n))return u(n)},M=e=>e.replaceAll(o,"").replaceAll(a,""),v=e=>new E(e);export{d as D,A as F,w as H,x as g,v as m,M as s};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { RollupLogger } from '@visulima/packem-share/utils';
|
|
2
|
-
import { Environment } from '@visulima/packem-share/types';
|
|
3
|
-
import { CustomPluginOptions, PluginContext } from 'rollup';
|
|
4
|
-
import { RawSourceMap } from 'source-map-js';
|
|
5
1
|
import { Options } from 'cssnano';
|
|
6
2
|
import { CustomAtRules, TransformOptions } from 'lightningcss';
|
|
7
3
|
import { Node, AcceptedPlugin, PluginCreator } from 'postcss';
|
|
8
4
|
import { Config } from 'postcss-load-config';
|
|
5
|
+
import { Environment } from '@visulima/packem-share/types';
|
|
9
6
|
import { StringOptions as StringOptions$1 } from 'sass';
|
|
10
7
|
import { StringOptions } from 'sass-embedded';
|
|
11
8
|
import { RenderOptions } from 'stylus';
|
|
9
|
+
import { RollupLogger } from '@visulima/packem-share/utils';
|
|
10
|
+
import { PluginContext, CustomPluginOptions } from 'rollup';
|
|
11
|
+
import { RawSourceMap } from 'source-map-js';
|
|
12
12
|
type LESSLoaderOptions = Less.Options;
|
|
13
13
|
type ImportResolve = (url: string, basedir: string, extensions: string[], atRule: Node) => Promise<string> | string;
|
|
14
14
|
interface ImportOptions {
|
|
@@ -72,6 +72,62 @@ type StylusLoaderOptions = RenderOptions & {
|
|
|
72
72
|
lineNumbers?: boolean;
|
|
73
73
|
use?: StylusPlugin[];
|
|
74
74
|
};
|
|
75
|
+
interface Extracted {
|
|
76
|
+
css: string;
|
|
77
|
+
id: string;
|
|
78
|
+
map?: string;
|
|
79
|
+
}
|
|
80
|
+
interface Loader<T = Record<string, unknown>> {
|
|
81
|
+
alwaysProcess?: boolean;
|
|
82
|
+
name: string;
|
|
83
|
+
process: (this: LoaderContext<T>, payload: Payload) => Payload | Promise<Payload>;
|
|
84
|
+
test?: RegExp | ((file: string) => boolean);
|
|
85
|
+
}
|
|
86
|
+
interface LoaderContext<T = Record<string, unknown>> {
|
|
87
|
+
readonly alias?: Record<string, string>;
|
|
88
|
+
readonly assets: Map<string, Uint8Array>;
|
|
89
|
+
readonly autoModules: InternalStyleOptions["autoModules"];
|
|
90
|
+
readonly browserTargets: string[];
|
|
91
|
+
readonly cwd?: string;
|
|
92
|
+
readonly debug?: boolean;
|
|
93
|
+
readonly deps: Set<string>;
|
|
94
|
+
readonly dts: InternalStyleOptions["dts"];
|
|
95
|
+
readonly emit: InternalStyleOptions["emit"];
|
|
96
|
+
readonly environment: Environment;
|
|
97
|
+
readonly extensions: InternalStyleOptions["extensions"];
|
|
98
|
+
readonly extract: InternalStyleOptions["extract"];
|
|
99
|
+
readonly id: string;
|
|
100
|
+
readonly inject: InternalStyleOptions["inject"];
|
|
101
|
+
readonly inline: InternalStyleOptions["inline"];
|
|
102
|
+
readonly logger: RollupLogger;
|
|
103
|
+
readonly namedExports: InternalStyleOptions["namedExports"];
|
|
104
|
+
readonly options: T;
|
|
105
|
+
readonly plugin: PluginContext;
|
|
106
|
+
readonly sourceDir?: string;
|
|
107
|
+
readonly sourceMap: false | (SourceMapOptions & {
|
|
108
|
+
inline: boolean;
|
|
109
|
+
});
|
|
110
|
+
readonly useSourcemap: boolean;
|
|
111
|
+
}
|
|
112
|
+
interface Payload {
|
|
113
|
+
code: string;
|
|
114
|
+
dts?: string;
|
|
115
|
+
extracted?: Extracted;
|
|
116
|
+
map?: string;
|
|
117
|
+
meta?: CustomPluginOptions;
|
|
118
|
+
}
|
|
119
|
+
interface SourceMapOptions {
|
|
120
|
+
content?: boolean;
|
|
121
|
+
transform?: (map: RawSourceMap, name?: string) => void;
|
|
122
|
+
}
|
|
123
|
+
type MinifierContext = {
|
|
124
|
+
readonly browserTargets: string[];
|
|
125
|
+
readonly logger: RollupLogger;
|
|
126
|
+
};
|
|
127
|
+
interface Minifier<Options = Record<string, any>> {
|
|
128
|
+
handler: (this: MinifierContext, data: ExtractedData, sourceMap: LoaderContext["sourceMap"], options: Options) => Promise<ExtractedData>;
|
|
129
|
+
name: string;
|
|
130
|
+
}
|
|
75
131
|
type AutoModules = RegExp | boolean | ((id: string) => boolean);
|
|
76
132
|
interface ExtractedData {
|
|
77
133
|
css: string;
|
|
@@ -107,11 +163,11 @@ interface PostCSSOptions {
|
|
|
107
163
|
config?: PostCSSConfigLoaderOptions | false;
|
|
108
164
|
import?: Partial<ImportOptions> | false;
|
|
109
165
|
modules?: ModulesOptions | boolean;
|
|
110
|
-
parser?: Config["parser"] | string;
|
|
166
|
+
parser?: NonNullable<Config["parser"]> | string;
|
|
111
167
|
plugins?: (AcceptedPlugin | string | [PluginCreator<unknown> | string, Record<string, unknown>] | [PluginCreator<unknown> | string] | null | undefined)[] | Record<string, unknown>;
|
|
112
|
-
stringifier?: Config["stringifier"] | string;
|
|
113
|
-
syntax?: Config["syntax"] | string;
|
|
114
|
-
to?: Config["to"]
|
|
168
|
+
stringifier?: NonNullable<Config["stringifier"]> | string;
|
|
169
|
+
syntax?: NonNullable<Config["syntax"]> | string;
|
|
170
|
+
to?: NonNullable<Config["to"]>;
|
|
115
171
|
url?: Partial<UrlOptions> | false;
|
|
116
172
|
}
|
|
117
173
|
interface StyleOptions {
|
|
@@ -135,60 +191,4 @@ interface StyleOptions {
|
|
|
135
191
|
sourceMap?: boolean | "inline" | [boolean | "inline", SourceMapOptions] | [boolean | "inline"];
|
|
136
192
|
stylus?: StylusLoaderOptions;
|
|
137
193
|
}
|
|
138
|
-
|
|
139
|
-
css: string;
|
|
140
|
-
id: string;
|
|
141
|
-
map?: string;
|
|
142
|
-
}
|
|
143
|
-
interface Loader<T = Record<string, unknown>> {
|
|
144
|
-
alwaysProcess?: boolean;
|
|
145
|
-
name: string;
|
|
146
|
-
process: (this: LoaderContext<T>, payload: Payload) => Payload | Promise<Payload>;
|
|
147
|
-
test?: RegExp | ((file: string) => boolean);
|
|
148
|
-
}
|
|
149
|
-
interface LoaderContext<T = Record<string, unknown>> {
|
|
150
|
-
readonly alias?: Record<string, string>;
|
|
151
|
-
readonly assets: Map<string, Uint8Array>;
|
|
152
|
-
readonly autoModules: InternalStyleOptions["autoModules"];
|
|
153
|
-
readonly browserTargets: string[];
|
|
154
|
-
readonly cwd?: string;
|
|
155
|
-
readonly debug?: boolean;
|
|
156
|
-
readonly deps: Set<string>;
|
|
157
|
-
readonly dts: InternalStyleOptions["dts"];
|
|
158
|
-
readonly emit: InternalStyleOptions["emit"];
|
|
159
|
-
readonly environment: Environment;
|
|
160
|
-
readonly extensions: InternalStyleOptions["extensions"];
|
|
161
|
-
readonly extract: InternalStyleOptions["extract"];
|
|
162
|
-
readonly id: string;
|
|
163
|
-
readonly inject: InternalStyleOptions["inject"];
|
|
164
|
-
readonly inline: InternalStyleOptions["inline"];
|
|
165
|
-
readonly logger: RollupLogger;
|
|
166
|
-
readonly namedExports: InternalStyleOptions["namedExports"];
|
|
167
|
-
readonly options: T;
|
|
168
|
-
readonly plugin: PluginContext;
|
|
169
|
-
readonly sourceDir?: string;
|
|
170
|
-
readonly sourceMap: false | (SourceMapOptions & {
|
|
171
|
-
inline: boolean;
|
|
172
|
-
});
|
|
173
|
-
readonly useSourcemap: boolean;
|
|
174
|
-
}
|
|
175
|
-
interface Payload {
|
|
176
|
-
code: string;
|
|
177
|
-
dts?: string;
|
|
178
|
-
extracted?: Extracted;
|
|
179
|
-
map?: string;
|
|
180
|
-
meta?: CustomPluginOptions;
|
|
181
|
-
}
|
|
182
|
-
interface SourceMapOptions {
|
|
183
|
-
content?: boolean;
|
|
184
|
-
transform?: (map: RawSourceMap, name?: string) => void;
|
|
185
|
-
}
|
|
186
|
-
type MinifierContext = {
|
|
187
|
-
readonly browserTargets: string[];
|
|
188
|
-
readonly logger: RollupLogger;
|
|
189
|
-
};
|
|
190
|
-
interface Minifier<Options = Record<string, any>> {
|
|
191
|
-
handler: (this: MinifierContext, data: ExtractedData, sourceMap: LoaderContext["sourceMap"], options: Options) => Promise<ExtractedData>;
|
|
192
|
-
name: string;
|
|
193
|
-
}
|
|
194
|
-
export { AutoModules as A, ExtractedData as E, InternalStyleOptions as I, Loader as L, Minifier as M, PostCSSConfigLoaderOptions as P, StylusLoaderOptions as S, LightningCSSOptions as a, LESSLoaderOptions as b, StylusDefinition as c, StylusLoaderContext as d, StylusPlugin as e, SassLoaderOptions as f, SassLoaderContext as g, StyleOptions as h, InjectOptions as i, PostCSSOptions as j, Extracted as k, LoaderContext as l };
|
|
194
|
+
export { AutoModules as A, ExtractedData as E, InternalStyleOptions as I, LESSLoaderOptions as L, Minifier as M, PostCSSConfigLoaderOptions as P, SassLoaderOptions as S, Loader as a, LightningCSSOptions as b, SassLoaderContext as c, StylusLoaderOptions as d, StylusDefinition as e, StylusLoaderContext as f, StylusPlugin as g, StyleOptions as h, InjectOptions as i, PostCSSOptions as j, Extracted as k, LoaderContext as l };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { SourceMapGenerator, RawSourceMap, SourceMapConsumer } from 'source-map-js';
|
|
2
|
-
import { k as Extracted, j as PostCSSOptions, h as StyleOptions, I as InternalStyleOptions, l as LoaderContext } from "../packem_shared/types.d-
|
|
2
|
+
import { k as Extracted, j as PostCSSOptions, h as StyleOptions, I as InternalStyleOptions, l as LoaderContext } from "../packem_shared/types.d-DbmFO7y3.js";
|
|
3
3
|
import { RollupLogger } from '@visulima/packem-share/utils';
|
|
4
4
|
import { Result } from 'postcss-load-config';
|
|
5
5
|
import { NapiResolveOptions } from 'oxc-resolver';
|
|
6
|
-
import '@visulima/packem-share/types';
|
|
7
|
-
import 'rollup';
|
|
8
6
|
import 'cssnano';
|
|
9
7
|
import 'lightningcss';
|
|
10
8
|
import 'postcss';
|
|
9
|
+
import '@visulima/packem-share/types';
|
|
11
10
|
import 'sass';
|
|
12
11
|
import 'sass-embedded';
|
|
13
12
|
import 'stylus';
|
|
13
|
+
import 'rollup';
|
|
14
14
|
declare const arrayFmt: (array: string[]) => string;
|
|
15
15
|
interface Concatenated {
|
|
16
16
|
css: string;
|
package/dist/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as o}from"../packem_shared/arrayFmt-
|
|
1
|
+
import{default as o}from"../packem_shared/arrayFmt-e_AFKxNC.js";import{default as t}from"../packem_shared/concat-DpBhQ_1z.js";import{default as p}from"../packem_shared/loadModule-_BdeIlVN.js";import{ensurePCSSOption as n,ensurePCSSPlugins as s,inferHandlerOption as l,inferModeOption as m,inferOption as d,inferSourceMapOption as u}from"../packem_shared/ensurePCSSOption-BkLq8-iV.js";import{resolve as M}from"../packem_shared/resolve-DLQikOnx.js";import{default as S}from"../packem_shared/safeId-BOlFTmJx.js";import{g,m as P,s as C}from"../packem_shared/sourcemap-DrC64huR.js";import{getUrlOfPartial as h,hasModuleSpecifier as v,normalizeUrl as y}from"../packem_shared/getUrlOfPartial-BdjQe1Mg.js";export{o as arrayFmt,t as concat,n as ensurePCSSOption,s as ensurePCSSPlugins,g as getMap,h as getUrlOfPartial,v as hasModuleSpecifier,l as inferHandlerOption,m as inferModeOption,d as inferOption,u as inferSourceMapOption,p as loadModule,P as mm,y as normalizeUrl,M as resolve,S as safeId,C as stripMap};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/rollup-plugin-css",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.57",
|
|
4
4
|
"description": "CSS processing plugin for packem",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"visulima",
|
|
@@ -97,9 +97,9 @@
|
|
|
97
97
|
],
|
|
98
98
|
"dependencies": {
|
|
99
99
|
"@rollup/pluginutils": "5.4.0",
|
|
100
|
-
"@visulima/fs": "5.0.
|
|
101
|
-
"@visulima/package": "5.0.
|
|
102
|
-
"@visulima/packem-share": "1.0.0-alpha.
|
|
100
|
+
"@visulima/fs": "5.0.2",
|
|
101
|
+
"@visulima/package": "5.0.2",
|
|
102
|
+
"@visulima/packem-share": "1.0.0-alpha.53",
|
|
103
103
|
"@visulima/path": "3.0.0",
|
|
104
104
|
"mlly": "1.8.2",
|
|
105
105
|
"oxc-resolver": "11.24.2",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var o=Object.defineProperty;var n=(e,r)=>o(e,"name",{value:r,configurable:!0});var u=Object.defineProperty,s=n((e,r)=>u(e,"name",{value:r,configurable:!0}),"s");const f=s(e=>e.map((r,c,a)=>{const t=`\`${r}\``;switch(c){case a.length-1:return`or ${t}`;case a.length-2:return t;default:return`${t},`}}).join(" "),"arrayFmt");export{f as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var a=Object.defineProperty;var o=(e,r)=>a(e,"name",{value:r,configurable:!0});import{browserslistToTargets as n}from"lightningcss";var i=Object.defineProperty,c=o((e,r)=>i(e,"name",{value:r,configurable:!0}),"r");const s=new Map,b=c(e=>{const r=e.join(",");let t=s.get(r);return t||(t=n(e),s.set(r,t)),t},"browserslistToTargetsCached");export{b as i};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var p=Object.defineProperty;var m=(o,n)=>p(o,"name",{value:n,configurable:!0});import{SourceMapGenerator as f}from"source-map-js";import{m as g}from"./sourcemap-DpWa6ejr.js";var d=Object.defineProperty,C=m((o,n)=>d(o,"name",{value:n,configurable:!0}),"f");const h=C(o=>{const n=new f({file:""}),s=[];let a=0;for(const{css:c,map:l}of o){s.push(c);const u=g(l),t=u.toObject();if(t){const i=u.toConsumer();if(i&&(i.eachMapping(e=>{const r={generated:{column:e.generatedColumn,line:a+e.generatedLine}};typeof e.originalLine=="number"&&typeof e.originalColumn=="number"&&typeof e.source=="string"&&(r.original={column:e.originalColumn,line:e.originalLine},r.source=e.source,typeof e.name=="string"&&(r.name=e.name)),n.addMapping(r)}),t.sourcesContent))for(const e of t.sources)n.setSourceContent(e,i.sourceContentFor(e,!0))}a+=c.split(`
|
|
2
|
-
`).length}return Promise.resolve({css:s.join(`
|
|
3
|
-
`),map:n})},"concat");export{h as default};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
var p=Object.defineProperty;var m=(s,t)=>p(s,"name",{value:t,configurable:!0});import{isAccessible as u,readFile as d,writeFile as g}from"@visulima/fs";import{normalize as f}from"@visulima/path";import{n}from"./ensure-auto-modules-CCI2Jajb.js";var y=Object.defineProperty,h=m((s,t)=>y(s,"name",{value:t,configurable:!0}),"c");const b=`
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
/* prettier-ignore */
|
|
4
|
-
// @ts-nocheck
|
|
5
|
-
/**
|
|
6
|
-
* Generated by packem
|
|
7
|
-
* @see https://npmjs.com/@visulima/packem
|
|
8
|
-
*/
|
|
9
|
-
`.trim(),k=h((s,t)=>{let i;return s.postcss&&typeof s.postcss.modules=="boolean"?i=s.postcss.modules:s.lightningcss&&typeof s.lightningcss.modules=="boolean"&&(i=s.lightningcss.modules),{name:"css-modules-types",async transform(v,e){let o=i;if(s.postcss&&typeof s.postcss.modules=="object"?o=n(s.postcss.modules.include,e):s.lightningcss&&typeof s.lightningcss.modules=="object"&&(o=n(s.lightningcss.modules.include,e)),s.autoModules&&o===void 0&&(o=n(s.autoModules,e)),!o)return;const c=this.getModuleInfo(e)?.meta.styles?.types;if(c!==void 0&&await u(e)){const l=`${e}.d.ts`,a=`${b}
|
|
10
|
-
${c}`;let r;await u(l)&&(r=await d(l)),r!==a&&(await g(l,a),this.info({message:`Generated types for ${f(e).replace(`${t}/`,"")}`,plugin:"css-modules-types"}))}}}},"cssModulesTypesPlugin");export{k as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var a=Object.defineProperty;var t=(e,o)=>a(e,"name",{value:o,configurable:!0});import{n}from"./ensure-auto-modules-CCI2Jajb.js";var c=Object.defineProperty,f=t((e,o)=>c(e,"name",{value:o,configurable:!0}),"n");const s=f((e,o,r)=>typeof e=="boolean"?e:typeof e=="object"?n(e.include,r):o?n(o,r):!1,"detectCssModules");export{s as p};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var o=Object.defineProperty;var t=(s,e)=>o(s,"name",{value:e,configurable:!0});var u=Object.defineProperty,n=t((s,e)=>u(s,"name",{value:e,configurable:!0}),"t");const c=/\.module\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/i,a=n((s,e)=>s===void 0?!0:typeof s=="function"?s(e):s instanceof RegExp?s.test(e):s&&c.test(e),"ensureAutoModules");export{a as n};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
var k=Object.defineProperty;var N=(e,t)=>k(e,"name",{value:t,configurable:!0});import{relative as V,basename as M}from"@visulima/path";import I from"./safeId-BN5akJYJ.js";var D=Object.defineProperty,g=N((e,t)=>D(e,"name",{value:t,configurable:!0}),"f");const x="css",C=new Set(["arguments","await","break","case","catch","class","const","continue",x,"debugger","default","delete","do","else","enum","eval","export","extends","false","finally","for","function","if","implements","import","in","instanceof","interface","let","new","null","package","private","protected","public","return","static","super","switch","this","throw","true","try","typeof","var","void","while","with","yield"]),B=g(e=>{const t=e.replaceAll(/[^\w$]/g,"_");return C.has(t)?`_${t}`:t},"getClassNameIdentifier"),_=g(({dts:e,dtsOutput:t,namedExports:s,output:r,outputExports:o})=>{if(!s)return;const n=`export {
|
|
2
|
-
${o.filter(Boolean).join(`,
|
|
3
|
-
`)}
|
|
4
|
-
};`;r.push(n),e&&t.push(n)},"appendNamedExports"),w=g(e=>`
|
|
5
|
-
interface ModulesExports {
|
|
6
|
-
${Object.keys(e).map(t=>` '${t.replaceAll("\\",String.raw`\\`).replaceAll("'",String.raw`\'`)}': string;`).join(`
|
|
7
|
-
`)}
|
|
8
|
-
}
|
|
9
|
-
`,"buildModulesExportsInterface"),A=g(({cssDeclared:e,cssVariableName:t,defaultExport:s,dtsOutput:r,inject:o,modulesExports:n,modulesVariableName:p,supportModules:u})=>{u?r.push(w(n),typeof o=="object"&&o.treeshakeable?"interface ModulesExports {inject:()=>void}":"",`declare const ${p}: ModulesExports;`):e||r.push(`declare const ${t}: string;`),r.push(s)},"appendModulesDts"),z=/^[$_a-z][\w$]*$/i,P=g(({cssVariableName:e,id:t,inject:s,modulesExports:r,modulesVariableName:o,output:n,saferId:p})=>{if(typeof s=="function"){n.push(s(e,t,n),`var ${o} = ${JSON.stringify(r)};`);return}const{treeshakeable:u,...c}=typeof s=="object"?s:{},f=p("injector"),d=`${f}(${e},${JSON.stringify(c)});`,a=typeof s=="object"&&s.package?s.package:"@visulima/css-style-inject",i=typeof s=="object"&&s.method?s.method:"cssStyleInject";if(typeof a!="string"||a.trim().length===0)throw new TypeError(`\`inject.package\` must be a non-empty string, received: ${JSON.stringify(a)}`);if(!z.test(i))throw new Error(`\`inject.method\` must be a valid JavaScript identifier, received: ${JSON.stringify(i)}`);if(n.unshift(`import { ${i} as ${f} } from "${a}";`),!u){n.push(`var ${o} = ${JSON.stringify(r)};`,d);return}n.push("var injected = false;");const l=`if (!injected) { injected = true; ${d} }`;if(r.inject)throw new Error("`inject` keyword is reserved when using `inject.treeshakeable` option");let $="";for(const[E,h]of Object.entries(r)){const m=JSON.stringify(E),y=JSON.stringify(h);$+=`get ${m}() { ${l} return ${y}; },
|
|
10
|
-
`}$+=`inject: function inject() { ${l} },`,n.push(`var ${o} = {${$}};`)},"applyInject"),S=g(({cwd:e,dts:t,dtsOutput:s,id:r,logger:o,modulesExports:n,namedExports:p,output:u,outputExports:c})=>{if(!p||Object.keys(n).length===0)return;const f=typeof p=="function"?p:B;for(const[d,a]of Object.entries(n)){const i=f(d);if(d!==i&&o){const $=e?V(e,r):r;o.warn({message:`Exported \`${d}\` as \`${i}\` in ${$}`})}const l=JSON.stringify(a);u.push(`var ${i} = ${l};`),t&&s.push(`declare const ${i}: ${l};`),c?.push(i)}},"appendClassExports"),R=g(({css:e,cssVariableName:t,cwd:s,dts:r,dtsOutput:o,id:n,logger:p,modulesExports:u,modulesVariableName:c,namedExports:f,supportModules:d})=>{const a=[`var ${t} = ${JSON.stringify(e)};`];S({cwd:s,dts:r,dtsOutput:o,id:n,logger:p,modulesExports:u,namedExports:f,output:a}),Object.keys(u).length>0&&a.push(`var ${c} = ${JSON.stringify(u)};`);const i=`
|
|
11
|
-
export default ${d?c:t};
|
|
12
|
-
`;return a.push(i),r&&(o.push(`declare const ${t}: string;`),d&&o.push(w(u),`declare const ${c}: ModulesExports;`),o.push(i)),{code:a.join(`
|
|
13
|
-
`),moduleSideEffects:!1,types:r?o.join(`
|
|
14
|
-
`):void 0}},"generateInlineExports"),G=g(({css:e,cwd:t,dts:s=!1,emit:r=!1,extract:o=!1,icssDependencies:n=[],id:p,inject:u,inline:c=!1,logger:f,map:d,modulesExports:a,namedExports:i,supportModules:l})=>{const $=g(J=>I(J,M(p)),"saferId"),E=$("modules"),h=[`var ${x} = ${JSON.stringify(e)};`],m=[],y=[x];if(i&&(s&&m.push(`declare const ${x}: string;`),S({cwd:t,dts:s,dtsOutput:m,id:p,logger:f,modulesExports:a,namedExports:i,output:h,outputExports:y})),c)return R({css:e,cssVariableName:x,cwd:t,dts:s,dtsOutput:m,id:p,logger:f,modulesExports:a,modulesVariableName:E,namedExports:i,supportModules:l});u&&P({cssVariableName:x,id:p,inject:u,modulesExports:a,modulesVariableName:E,output:h,saferId:$}),!u&&Object.keys(a).length>0&&h.push(`var ${E} = ${JSON.stringify(a)};`);const b=`
|
|
15
|
-
export default ${l?E:x};
|
|
16
|
-
`;h.push(b),s&&A({cssDeclared:!!i,cssVariableName:x,defaultExport:b,dtsOutput:m,inject:u,modulesExports:a,modulesVariableName:E,supportModules:l}),_({dts:s,dtsOutput:m,namedExports:i,output:h,outputExports:y});const j=h.filter(Boolean).join(`
|
|
17
|
-
`),O=m.length>0?m.filter(Boolean).join(`
|
|
18
|
-
`):void 0;if(r)return{code:e,map:d,meta:{icssDependencies:n,moduleContents:j,types:void 0},moduleSideEffects:!0};let v;return o&&(v={css:e,id:p,map:d}),{code:j,extracted:v,map:d,meta:{icssDependencies:n,moduleContents:j,types:O},moduleSideEffects:l||typeof u=="object"&&u.treeshakeable?!1:"no-treeshake",types:O}},"generateJsExports");export{G as g};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var s=Object.defineProperty;var l=(e,r)=>s(e,"name",{value:r,configurable:!0});import{parse as t,normalize as i,isAbsolute as n}from"@visulima/path";import{isRelative as c}from"@visulima/path/utils";var f=Object.defineProperty,a=l((e,r)=>f(e,"name",{value:r,configurable:!0}),"e");const m=/^~[\d@A-Z]/i,p=a(e=>m.test(e),"hasModuleSpecifier"),v=a(e=>{const{base:r,dir:o}=t(e);return o?`${i(o)}/_${r}`:`_${r}`},"getUrlOfPartial"),U=a(e=>p(e)?i(e.slice(1)):n(e)||c(e)?i(e):`./${i(e)}`,"normalizeUrl");export{v as getUrlOfPartial,p as hasModuleSpecifier,U as normalizeUrl};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var f=Object.defineProperty;var c=(n,e)=>f(n,"name",{value:e,configurable:!0});import d from"./arrayFmt-Dek5cB7m.js";import m from"./loadModule-DYNNk5sK.js";var y=Object.defineProperty,o=c((n,e)=>y(n,"name",{value:e,configurable:!0}),"r");const p=["inject","extract","emit","inline"],g=d(p),P=o((n,e)=>{const i=Array.isArray(n)?n:[n];if(i[0]&&!p.includes(i[0]))throw new Error(`Incorrect mode provided, allowed modes are ${g}`);const r=i[0]??"inject";let t=!1,a=!1;return r==="extract"&&(t=i[1]??!0),r==="inject"&&(a=i[1]??!0),(r==="emit"||r==="inline")&&i[1]!==void 0&&e?.warn({message:`The "${r}" mode does not accept additional options; ignoring the provided tuple option.`,plugin:"css"}),{emit:r==="emit",extract:t,inject:a,inline:r==="inline"}},"inferModeOption"),S=o((n,e)=>typeof n=="boolean"?n&&{}:typeof n=="object"?n:e,"inferOption"),j=o(n=>{const e=Array.isArray(n)?n:[n];return e[0]?{content:!0,...e[1],inline:e[0]==="inline"}:!1},"inferSourceMapOption"),v=o((n,e)=>{const i=S(n,{});return e&&typeof i=="object"&&!i.alias&&(i.alias=e),i},"inferHandlerOption"),s=o(async(n,e,i,r)=>{if(typeof n!="string")return n;const t=await m(n,i,r);if(!t)throw new Error(`Unable to load PostCSS ${e} \`${n}\``);return t},"ensurePCSSOption"),b=o(async(n,e,i)=>{if(n===void 0)return[];if(n.length===0)return[];const r=[];for(const t of n.filter(Boolean)){if(!Array.isArray(t)){r.push(await s(t,"plugin",e,i));continue}const[a,l]=t;if(l){const u=await s(a,"plugin",e,i);r.push(u(l))}else r.push(await s(a,"plugin",e,i))}return r},"ensurePCSSPlugins");export{s as ensurePCSSOption,b as ensurePCSSPlugins,v as inferHandlerOption,P as inferModeOption,S as inferOption,j as inferSourceMapOption};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var m=Object.defineProperty;var u=(e,o)=>m(e,"name",{value:o,configurable:!0});import{createRequire as f}from"node:module";import{interopDefault as p,loadModule as g}from"mlly";import{resolve as h}from"./resolve-D5Aw9ctO.js";var w=Object.defineProperty,i=u((e,o)=>w(e,"name",{value:o,configurable:!0}),"a");const a=new Map,R=[".js",".mjs",".cjs",".json"],y=i(async(e,o)=>{try{return o(e)}catch(s){const t=s;if(t.code==="ERR_REQUIRE_ESM")return p(await g(e));throw t}},"loadModuleFromPath"),$=i(async(e,o,s)=>{const t=`${o}\0${e}`;if(a.has(t)){const r=a.get(t);if(r===null)return;const l=r;return l?.default??l}const c={baseDirs:[o],caller:"Module loader",extensions:R,symlinks:!1},d=f(import.meta.url);try{const r=h([e,`./${e}`],c);if(r.startsWith("data:")){s.warn({message:`Skipping data URL module: ${e}`,module:e,plugin:"css"}),a.set(t,null);return}a.set(t,await y(r,d))}catch(r){s.warn({message:`Failed to resolve or load module: ${r instanceof Error?r.message:String(r)}`,module:e,plugin:"css"}),a.set(t,null);return}const n=a.get(t);return n?.default??n},"loadModule");export{$ as default};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var g=Object.defineProperty;var m=(o,e)=>g(o,"name",{value:e,configurable:!0});import{fileURLToPath as u}from"node:url";import{dirname as p}from"@visulima/path";import{ResolverFactory as v}from"oxc-resolver";import a from"./arrayFmt-Dek5cB7m.js";var y=Object.defineProperty,i=m((o,e)=>y(o,"name",{value:e,configurable:!0}),"i");const h=p(u(import.meta.url)),f=new Map,d=i((o,e)=>{const r=JSON.stringify({extensions:o,symlinks:e});let t=f.get(r);return t||(t=new v({extensions:o,symlinks:e}),f.set(r,t)),t},"getResolver"),j=i((o,e,r,t)=>{try{const{error:s,path:n}=o.sync(e,r);if(n)return n;s&&t.push(`"${r}" from "${e}": ${s}`)}catch(s){const n=s instanceof Error?s.message:String(s);t.push(`"${r}" from "${e}": ${n}`)}},"tryResolve"),D=i((o,e)=>{const r={baseDirs:[h],caller:"Resolver",extensions:[".mjs",".js",".cjs",".json"],symlinks:!0,...e},t=d(r.extensions,r.symlinks),s=[];for(const l of r.baseDirs)for(const $ of o){const c=j(t,l,$,s);if(c)return c}const n=s.length>0?`
|
|
2
|
-
Tried:
|
|
3
|
-
${s.map(l=>` - ${l}`).join(`
|
|
4
|
-
`)}`:"";throw e.logger&&s.length>0&&e.logger.debug?.({message:`${r.caller} could not resolve ${a(o)}.${n}`}),new Error(`${r.caller} could not resolve ${a(o)}.${n}`)},"resolve");export{D as resolve};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var ee=Object.defineProperty;var z=(e,s)=>ee(e,"name",{value:s,configurable:!0});import{createFilter as se}from"@rollup/pluginutils";import{createRollupLogger as te}from"@visulima/packem-share/utils";import{dirname as L,normalize as j,isAbsolute as oe,relative as V,resolve as ie,parse as _,join as G,basename as W}from"@visulima/path";import{isRelative as re}from"@visulima/path/utils";import ne from"p-queue";import ae from"./concat-D-keMgEe.js";import{inferSourceMapOption as ce,inferModeOption as Z,inferHandlerOption as B,inferOption as X,ensurePCSSOption as Q,ensurePCSSPlugins as le}from"./inferModeOption-D5fRQduB.js";import{m as q}from"./sourcemap-DpWa6ejr.js";var de=Object.defineProperty,pe=z((e,s)=>de(e,"name",{value:s,configurable:!0}),"r");const J=pe((e,s)=>{if(!s)return!1;if(typeof s=="function")return s(e);if(typeof s.test=="function")return s.test(e);throw new Error("Invalid condition type")},"matchFile");var ue=Object.defineProperty,fe=z((e,s)=>ue(e,"name",{value:s,configurable:!0}),"l");const me=4,A=process.env.UV_THREADPOOL_SIZE?Number.parseInt(process.env.UV_THREADPOOL_SIZE,10):Number.NaN,ge=Number.isFinite(A)&&A>0?A:me,he=Math.max(1,ge-1);class xe{static{z(this,"h")}static{fe(this,"LoaderManager")}test;loaders=new Map;options;workQueue;logger;constructor({extensions:s,loaders:d,logger:y,options:N}){this.test=S=>{const x=S.toLowerCase();return s.some(P=>x.endsWith(P))},d.length>0&&this.add(...d),this.options=N,this.logger=y}add(...s){for(const d of s)this.loaders.has(d.name)||this.loaders.set(d.name,d)}isSupported(s){if(this.test(s))return!0;for(const[,d]of this.loaders)if(J(s,d.test))return!0;return!1}async process(s,d){this.workQueue??=new ne({concurrency:he});for(const[y,N]of this.loaders){const S={...d,options:this.options[y]??{}};if(N.alwaysProcess||J(S.id,N.test)){this.logger.debug({message:`Processing ${y} loader for ${S.id}`,plugin:"css"});try{const x=await this.workQueue.add(N.process.bind(S,s));s={...x,extracted:x.extracted??s.extracted,meta:x.meta??s.meta},this.logger.debug({message:`Completed ${y} loader for ${S.id}`,outputSize:x.code.length,plugin:"css"})}catch(x){throw this.logger.error({file:S.id,loader:y,message:`Error in ${y} loader for ${S.id}: ${x instanceof Error?x.message:String(x)}`,plugin:"css"}),x}}}return s}}var ye=Object.defineProperty,F=z((e,s)=>ye(e,"name",{value:s,configurable:!0}),"k");const Se=/^\.[/\\]/,be=/\S/,we=F((e,s)=>e.toSorted((d,y)=>s.indexOf(d.name)-s.indexOf(y.name)),"sortByNameOrder"),Fe=F((e,s,d,y,N,S,x,P,K)=>{const C={...K,...e.alias},U=se(e.include,e.exclude),v=ce(e.sourceMap),i={...Z(e.mode),autoModules:e.autoModules??!1,dts:e.dts,extensions:e.extensions,namedExports:e.namedExports};let c,O,H=!1;if(e.loaders)for(const o of e.loaders)o.name==="postcss"&&(H=!0);else e.loaders=[];H&&(i.postcss={...e.postcss,config:X(e.postcss?.config,{}),import:B(e.postcss?.import,C),modules:X(e.postcss?.modules,void 0),to:e.postcss?.to,url:B(e.postcss?.url,C)});const $=new Map,I=F((o,f)=>{const m=[];for(const n of Object.keys(o)){const a=new Set;let g=[n];do{const M=[];for(const h of g){if(a.has(h))continue;if(O.isSupported(h)){U(h)&&M.push(h);continue}a.add(h);const k=f(h);k&&M.push(...k.importedIds)}g=M}while(g.some(M=>!O.isSupported(M)));m.push(...g)}return m},"traverseImportedModules");return{augmentChunkHash(o){if($.size===0)return;const f=I(o.modules,this.getModuleInfo),m=new Map;f.forEach((a,g)=>m.set(a,g));const n=[...$.values()].filter(a=>m.has(a.id)).toSorted((a,g)=>m.get(a.id)-m.get(g.id)).map(a=>`${W(a.id)}:${a.css}`);if(n.length!==0)return n.join(":")},async buildStart(){$.clear(),c=te(this,"css"),Z(e.mode,c),H&&i.postcss&&(e.postcss?.parser&&(i.postcss.parser=await Q(e.postcss.parser,"parser",d,c)),e.postcss?.syntax&&(i.postcss.syntax=await Q(e.postcss.syntax,"syntax",d,c)),e.postcss?.stringifier&&(i.postcss.stringifier=await Q(e.postcss.stringifier,"stringifier",d,c)),e.postcss?.plugins&&(i.postcss.plugins=await le(e.postcss.plugins,d,c))),O=new xe({extensions:i.extensions,loaders:we(e.loaders??[],["sourcemap","stylus","less","sass","postcss"]),logger:c,options:{...e,...i,alias:C}}),c.info({extract:typeof i.extract=="string"?i.extract:"individual",loaders:e.loaders?.map(o=>o.name)??[],message:"CSS plugin initialized",minify:!!(P&&e.minifier),namedExports:!!i.namedExports,plugin:"css",sourceMap:S}),typeof i.inject=="object"&&i.inject.treeshakeable&&(i.namedExports=!1,c.info({message:"Disabling named exports due to `inject.treeshakeable` option",plugin:"css"}))},async generateBundle(o,f){if($.size===0||!(o.dir||o.file))return;const m=Object.values(f),n=o.dir??L(o.file),a=m.filter(r=>r.type==="chunk"),g=a.filter(r=>!r.facadeModuleId),M=o.preserveModules?a:a.filter(r=>r.isEntry||r.isDynamicEntry),h=[],k=F(async(r,u)=>{const t=typeof i.extract=="string"?j(i.extract).replace(Se,""):j(`${r}.css`);oe(t)&&this.error(["Extraction path must be relative to the output directory,",`which is ${V(d,n)}`].join(`
|
|
2
|
-
`)),re(t)&&this.error(["Extraction path must be nested inside output directory,",`which is ${V(d,n)}`].join(`
|
|
3
|
-
`));const p=new Map;u.forEach((b,l)=>p.set(b,l));const w=[...$.values()].filter(b=>p.has(b.id)).toSorted((b,l)=>p.get(b.id)-p.get(l.id)),E=await ae(w);return{css:E.css,map:q(E.map.toString()).relative(L(ie(n,t))).toString(),name:t}},"getExtractedData"),R=F(r=>{if(o.file)return _(o.file).name;if(o.preserveModules){const{dir:u,name:t}=_(r.fileName);return u?G(u,t):t}return r.name},"getName"),D=new Set;if(typeof i.extract=="string"){c.debug({message:`Extracting to ${i.extract}`,prefix:"css"});const r=[];for(const t of g){const p=I(t.modules,this.getModuleInfo);for(const w of p)D.add(w);r.push(...p)}for(const t of M)r.push(...I(t.modules,this.getModuleInfo).filter(p=>!D.has(p)));const u=R(a[0]);h.push([u,r])}else{c.debug({message:"Extracting to individual files",prefix:"css"});for(const r of g){const u=I(r.modules,this.getModuleInfo);if(u.length===0)continue;for(const p of u)D.add(p);const t=R(r);h.push([t,u])}for(const r of M){const u=I(r.modules,this.getModuleInfo).filter(p=>!D.has(p));if(u.length===0)continue;const t=R(r);h.push([t,u])}}for(const[r,u]of h){const t=await k(r,u);if(typeof e.onExtract=="function"&&!e.onExtract(t))continue;if(P&&e.minifier){c.info({message:`Minifying ${t.name} with ${e.minifier.name}`,prefix:"css"});const{css:w,map:E}=await e.minifier.handler.bind({browserTargets:s,logger:c})(t,v,e[e.minifier.name]??{});t.css=w,t.map=E}const p={fileName:t.name,name:t.name,names:[t.name],originalFileName:t.name,originalFileNames:[t.name],source:t.css,type:"asset"};if(t.map&&v){const w=t.name;let E="assets";typeof o.assetFileNames=="string"?E=j(L(o.assetFileNames)):typeof o.assetFileNames=="function"&&(E=j(L(o.assetFileNames(p))));const b=q(t.map).modify(l=>(l.file=W(w),l)).modifySources(l=>{if(l==="<no source>"||E.length<=1)return l;l=`../${l}`;for(const T of E)T==="/"&&(l=`../${l}`);return l});if(v.inline)b.modify(l=>v.transform?.(l,j(G(n,w)))),p.source+=b.toCommentData(),c.debug({message:`Generated inline source map for ${w}`,plugin:"css"});else{const l=`${w}.map`;b.modify(Y=>v.transform?.(Y,j(G(n,l)))),this.emitFile({fileName:l,source:b.toString(),type:"asset"});const{base:T}=_(l);p.source+=b.toCommentFile(T),c.debug({message:`Generated external source map: ${l}`,plugin:"css"})}}this.emitFile(p),c.info({chunkIds:u.length,hasSourceMap:!!(t.map&&v),message:`Emitted CSS file: ${t.name}`,plugin:"css",size:p.source.length})}h.length>0&&c.info({filesEmitted:h.length,message:"CSS processing complete",plugin:"css",totalExtracted:$.size,totalSize:h.reduce((r,[,u])=>r+u.length,0)})},moduleParsed(o){const f=o.meta.extracted;f&&$.set(f.id,f)},name:"rollup-plugin-css",async transform(o,f){if(!U(f)||!O.isSupported(f))return;if(!be.test(o)){c.debug({message:`Skipping empty file: ${f}`,plugin:"css"});return}c.info({message:`Processing CSS file: ${f}`,plugin:"css",size:o.length}),typeof e.onImport=="function"&&e.onImport(o,f);const m={alias:C,assets:new Map,autoModules:i.autoModules,browserTargets:s,cwd:d,debug:x,deps:new Set,dts:i.dts,emit:i.emit,environment:N,extensions:i.extensions,extract:i.extract,id:f,inject:i.inject,inline:i.inline,logger:c,namedExports:i.namedExports,options:{},plugin:this,sourceDir:y,sourceMap:v,useSourcemap:S},n=await O.process({code:o},m);c.info({assets:m.assets.size,dependencies:m.deps.size,hasExtracted:!!n.extracted,message:`Processed ${f}`,outputSize:n.code.length,plugin:"css"});for(const a of m.deps)this.addWatchFile(a);for(const[a,g]of m.assets)this.emitFile({fileName:a,source:g,type:"asset"}),c.debug({message:`Emitted asset: ${a}`,plugin:"css",size:g.length});if(n.extracted){const{id:a}=n.extracted;$.set(a,n.extracted),c.debug({cssSize:n.extracted.css.length,hasSourceMap:!!n.extracted.map,message:`Extracted CSS from ${a}`,plugin:"css"})}return{code:n.code,map:v&&n.map?n.map:{mappings:""},meta:{extracted:n.extracted,styles:n.meta},moduleSideEffects:n.extracted?!0:void 0}}}},"cssPlugin");export{Fe as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var i=Object.defineProperty;var a=(e,r)=>i(e,"name",{value:r,configurable:!0});import{makeLegalIdentifier as o}from"@rollup/pluginutils";import{getHash as n}from"@visulima/packem-share/utils";var f=Object.defineProperty,s=a((e,r)=>f(e,"name",{value:r,configurable:!0}),"e");const u=s((e,...r)=>{const t=n([e,"0iOXBLSx",...r].join(":")).slice(0,8);return o(`${e}_${t}`)},"safeId");export{u as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var h=Object.defineProperty;var i=(r,s)=>h(r,"name",{value:s,configurable:!0});import{isAccessibleSync as f,readFileSync as l}from"@visulima/fs";import{resolve as m,isAbsolute as g,relative as d,normalize as S,dirname as E}from"@visulima/path";import{SourceMapConsumer as b}from"source-map-js";const O=/\[hash(?::(\d+))?\]/,U=/(?<!^|[/\\])(\.[^\s.]+)/,M=/data:[^\n\r;]+(?:;charset=[^\n\r;]+)?;base64,([\d+/A-Za-z]+={0,2})/;var R=Object.defineProperty,t=i((r,s)=>R(r,"name",{value:s,configurable:!0}),"i");const o=/(?:\n|\r\n)?\/\*[#*@]+\s*sourceMappingURL\s*=\s*(\S+)\s*\*+\//g,n=/(?:\n|\r\n)?\/\/[#@]+\s*sourceMappingURL\s*=\s*(\S+)\s*/g;class y{static{i(this,"b")}static{t(this,"MapModifier")}map;constructor(s){if(typeof s=="string")try{this.map=JSON.parse(s)}catch{}else this.map=s}modify(s){return this.map?(s(this.map),this):this}modifySources(s){return this.map?(this.map.sources=this.map.sources.map(e=>s(e)),this):this}resolve(s=process.cwd()){return this.modifySources(e=>e==="<no source>"?e:m(s,e))}relative(s=process.cwd()){return this.modifySources(e=>e==="<no source>"?e:g(e)?d(s,e):S(e))}toObject(){return this.map}toString(){return this.map?JSON.stringify(this.map):this.map}toConsumer(){return this.map?new b(this.map):this.map}toCommentData(){const s=this.toString();return s?`
|
|
2
|
-
/*# sourceMappingURL=data:application/json;base64,${Buffer.from(s).toString("base64")} */`:""}toCommentFile(s){return this.map?`
|
|
3
|
-
/*# sourceMappingURL=${s} */`:""}}const _=t((r,s)=>{const e=new RegExp(o.source,o.flags.replace("g","")),u=new RegExp(n.source,n.flags.replace("g","")),[,a]=e.exec(r)??u.exec(r)??[];if(!a)return;const[,p]=M.exec(a)??[];if(p)return Buffer.from(p,"base64").toString();if(!s)throw new Error("Extracted map detected, but no ID is provided");const c=m(E(s),a);if(f(c))return l(c)},"getMap"),C=t(r=>r.replaceAll(o,"").replaceAll(n,""),"stripMap"),D=t(r=>new y(r),"mm");export{M as D,U as F,O as H,_ as g,D as m,C as s};
|