@visulima/rollup-plugin-css 1.0.0-alpha.44 → 1.0.0-alpha.46
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 +23 -0
- package/dist/index.d.ts +16 -40
- package/dist/index.js +1 -1
- package/dist/loaders/less/index.d.ts +13 -36
- package/dist/loaders/less/index.js +1 -1
- package/dist/loaders/lightningcss.d.ts +13 -13
- package/dist/loaders/lightningcss.js +3 -3
- package/dist/loaders/postcss/index.d.ts +13 -27
- package/dist/loaders/postcss/index.js +6 -6
- package/dist/loaders/sass/index.d.ts +14 -4
- package/dist/loaders/sass/index.js +6 -6
- package/dist/loaders/sourcemap.d.ts +13 -24
- package/dist/loaders/sourcemap.js +1 -1
- package/dist/loaders/stylus/index.d.ts +14 -7
- package/dist/loaders/stylus/index.js +2 -2
- package/dist/loaders/tailwindcss-oxide.d.ts +13 -5
- package/dist/loaders/tailwindcss-oxide.js +1 -1
- package/dist/minifiers/cssnano.d.ts +13 -30
- package/dist/minifiers/cssnano.js +1 -1
- package/dist/minifiers/lightningcss.d.ts +13 -29
- package/dist/minifiers/lightningcss.js +2 -2
- package/dist/packem_shared/concat-CWFnPzjp.js +3 -0
- package/dist/packem_shared/{cssModulesTypesPlugin-CjGroK2y.js → cssModulesTypesPlugin-Bf3f6dn3.js} +2 -2
- package/dist/packem_shared/generate-js-exports-DKOz4w8t.js +23 -0
- package/dist/packem_shared/{getMap-TR-0DXUr.js → getMap-Dlan_u0E.js} +1 -1
- package/dist/packem_shared/hasModuleSpecifier-DKQ_-lwa.js +1 -0
- package/dist/packem_shared/inferModeOption-CJYqAvV-.js +1 -0
- package/dist/packem_shared/loadModule-B0QEI5Uu.js +1 -0
- package/dist/packem_shared/resolve-CEc8oUE8.js +1 -0
- package/dist/packem_shared/rollupCssPlugin-DFW2gy2m.js +3 -0
- package/dist/packem_shared/sourcemap-LKvHG-1m.js +3 -0
- package/dist/packem_shared/types.d-C-ij3n7X.d.ts +194 -0
- package/dist/utils/index.d.ts +63 -9
- package/dist/utils/index.js +1 -1
- package/package.json +21 -21
- package/dist/css-modules-types.d.ts +0 -38
- package/dist/css-plugin.d.ts +0 -44
- package/dist/loaders/less/importer.d.ts +0 -2
- package/dist/loaders/less/types.d.ts +0 -24
- package/dist/loaders/loader-manager.d.ts +0 -78
- package/dist/loaders/postcss/constants.d.ts +0 -20
- package/dist/loaders/postcss/icss/index.d.ts +0 -8
- package/dist/loaders/postcss/icss/load.d.ts +0 -5
- package/dist/loaders/postcss/icss/resolve.d.ts +0 -6
- package/dist/loaders/postcss/import/apply-conditions.d.ts +0 -10
- package/dist/loaders/postcss/import/apply-raws.d.ts +0 -3
- package/dist/loaders/postcss/import/apply-styles.d.ts +0 -10
- package/dist/loaders/postcss/import/constants.d.ts +0 -12
- package/dist/loaders/postcss/import/import-resolve.d.ts +0 -3
- package/dist/loaders/postcss/import/index.d.ts +0 -12
- package/dist/loaders/postcss/import/parser/parse-at-import.d.ts +0 -9
- package/dist/loaders/postcss/import/parser/parse-styles.d.ts +0 -6
- package/dist/loaders/postcss/import/parser/parse-stylesheet.d.ts +0 -10
- package/dist/loaders/postcss/import/types.d.ts +0 -95
- package/dist/loaders/postcss/import/utils/base64-encoded-import.d.ts +0 -3
- package/dist/loaders/postcss/import/utils/data-url.d.ts +0 -2
- package/dist/loaders/postcss/import/utils/format-import-prelude.d.ts +0 -2
- package/dist/loaders/postcss/import/utils/load-content.d.ts +0 -2
- package/dist/loaders/postcss/import/utils/process-content.d.ts +0 -4
- package/dist/loaders/postcss/import/utils/statement.d.ts +0 -6
- package/dist/loaders/postcss/load-config.d.ts +0 -6
- package/dist/loaders/postcss/modules/generate.d.ts +0 -11
- package/dist/loaders/postcss/modules/index.d.ts +0 -35
- package/dist/loaders/postcss/noop.d.ts +0 -22
- package/dist/loaders/postcss/url/generate.d.ts +0 -2
- package/dist/loaders/postcss/url/index.d.ts +0 -46
- package/dist/loaders/postcss/url/inline.d.ts +0 -20
- package/dist/loaders/postcss/url/url-resolve.d.ts +0 -12
- package/dist/loaders/postcss/url/utils.d.ts +0 -4
- package/dist/loaders/sass/modern/importer.d.ts +0 -3
- package/dist/loaders/sass/types.d.ts +0 -20
- package/dist/loaders/sass/utils/get-sass-compiler.d.ts +0 -8
- package/dist/loaders/sass/utils/get-sass-options.d.ts +0 -7
- package/dist/loaders/sass/utils/normalize-source-map.d.ts +0 -3
- package/dist/loaders/sass/utils/resolve-syntax.d.ts +0 -2
- package/dist/loaders/sass/utils/sass-error-factory.d.ts +0 -15
- package/dist/loaders/stylus/types.d.ts +0 -87
- package/dist/loaders/types.d.ts +0 -102
- package/dist/loaders/utils/ensure-auto-modules.d.ts +0 -39
- package/dist/loaders/utils/match-file.d.ts +0 -32
- package/dist/minifiers/types.d.ts +0 -64
- package/dist/packem_shared/concat-WcWAYbOc.js +0 -3
- package/dist/packem_shared/generate-js-exports-BhS4eLrN.js +0 -23
- package/dist/packem_shared/hasModuleSpecifier-DIZeev_W.js +0 -1
- package/dist/packem_shared/inferModeOption-9h3Eq6JH.js +0 -1
- package/dist/packem_shared/loadModule-D20jQQNu.js +0 -1
- package/dist/packem_shared/resolve-anj9ucIq.js +0 -1
- package/dist/packem_shared/rollupCssPlugin-BxRedPmA.js +0 -3
- package/dist/packem_shared/sourcemap-CB6ochh0.js +0 -3
- package/dist/types.d.ts +0 -224
- package/dist/utils/array-fmt.d.ts +0 -18
- package/dist/utils/concat.d.ts +0 -34
- package/dist/utils/generate-js-exports.d.ts +0 -78
- package/dist/utils/load-module.d.ts +0 -3
- package/dist/utils/options.d.ts +0 -155
- package/dist/utils/resolve.d.ts +0 -35
- package/dist/utils/safe-id.d.ts +0 -23
- package/dist/utils/sourcemap.d.ts +0 -42
- package/dist/utils/url.d.ts +0 -8
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* ```css
|
|
14
|
-
* // Input CSS with inline source map
|
|
15
|
-
* .example { color: red; }
|
|
16
|
-
* //# sourceMappingURL=data:application/json;base64,...
|
|
17
|
-
* ```
|
|
18
|
-
* @example
|
|
19
|
-
* ```css
|
|
20
|
-
* // Output CSS with source map stripped
|
|
21
|
-
* .example { color: red; }
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
1
|
+
import { L as Loader } from "../packem_shared/types.d-C-ij3n7X.js";
|
|
2
|
+
import 'cssnano';
|
|
3
|
+
import 'lightningcss';
|
|
4
|
+
import 'postcss';
|
|
5
|
+
import 'postcss-load-config';
|
|
6
|
+
import '@visulima/packem-share/types';
|
|
7
|
+
import 'sass';
|
|
8
|
+
import 'sass-embedded';
|
|
9
|
+
import 'stylus';
|
|
10
|
+
import '@visulima/packem-share/utils';
|
|
11
|
+
import 'rollup';
|
|
12
|
+
import 'source-map-js';
|
|
24
13
|
declare const loader: Loader;
|
|
25
|
-
export default
|
|
14
|
+
export { loader as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e,s as o}from"../packem_shared/sourcemap-
|
|
1
|
+
import{g as e,s as o}from"../packem_shared/sourcemap-LKvHG-1m.js";const r={alwaysProcess:!0,name:"sourcemap",process({code:a,map:s}){return{code:o(a),map:e(a,this.id)??s}}};export{r as default};
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { S as StylusLoaderOptions, L as Loader } from "../../packem_shared/types.d-C-ij3n7X.js";
|
|
2
|
+
export { type c as StylusDefinition, type d as StylusLoaderContext, type e as StylusPlugin } from "../../packem_shared/types.d-C-ij3n7X.js";
|
|
3
|
+
import 'cssnano';
|
|
4
|
+
import 'lightningcss';
|
|
5
|
+
import 'postcss';
|
|
6
|
+
import 'postcss-load-config';
|
|
7
|
+
import '@visulima/packem-share/types';
|
|
8
|
+
import 'sass';
|
|
9
|
+
import 'sass-embedded';
|
|
10
|
+
import 'stylus';
|
|
11
|
+
import '@visulima/packem-share/utils';
|
|
12
|
+
import 'rollup';
|
|
13
|
+
import 'source-map-js';
|
|
6
14
|
declare const loader: Loader<StylusLoaderOptions>;
|
|
7
|
-
export default
|
|
8
|
-
export type { StylusDefinition, StylusLoaderContext, StylusLoaderOptions, StylusPlugin } from "./types.d.ts";
|
|
15
|
+
export { type StylusLoaderOptions, loader as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
${
|
|
1
|
+
var T=Object.defineProperty;var S=(e,t)=>T(e,"name",{value:t,configurable:!0});import{existsSync as E}from"node:fs";import{readFileSync as F}from"@visulima/fs";import{normalize as h,dirname as D,join as w}from"@visulima/path";import O from"stylus";import b from"../../packem_shared/loadModule-B0QEI5Uu.js";import{m as _}from"../../packem_shared/sourcemap-LKvHG-1m.js";var k=Object.defineProperty,d=S((e,t)=>k(e,"name",{value:t,configurable:!0}),"c");const z=d((e,t)=>{if(!e.sourcesContent)return e.sources.map(s=>{const n=h(w(t,s));if(E(n))return F(n)}).filter(Boolean)},"populateSourcemapContent"),B=d(async(e,t,s)=>{if(typeof e=="function")return e;if(typeof e=="string"){const n=await b(e,t,s);if(typeof n!="function")throw new TypeError(`The Stylus implementation "${e}" is not a function.`);return n}return O},"resolveImplementation"),I=d((e,t)=>{if(!t)return;const s=Array.isArray(t)?t:Object.entries(t);for(const n of s){const[r,a,c]=n;e.define(r,a,c)}},"applyDefinitions"),L=d(async(e,t,s,n)=>{if(!(!t||t.length===0))for(const r of t){if(typeof r=="function"){e.use(r);continue}const a=await b(r,s,n);if(typeof a!="function")throw new TypeError(`Failed to load "${r}" Stylus plugin. Are you sure it's installed and exports a function?`);const c=a,u=c(),f=typeof u=="function"?u:c;e.use(f)}},"applyPlugins"),K={name:"stylus",async process({code:e,map:t}){const{additionalData:s,define:n,disableCache:r,hoistAtrules:a,implementation:c,import:u,include:f,includeCSS:C,lineNumbers:$,use:P,...y}=this.options,p=h(D(this.id)),l=this.cwd??process.cwd(),g=[p,w(p,"node_modules"),w(l,"node_modules")];y.paths&&g.push(...y.paths);let m=e;if(s!==void 0){const i={environment:this.environment,resourcePath:this.id,rootContext:l};m=typeof s=="function"?await s(m,i):`${s}
|
|
2
|
+
${m}`}const o=(await B(c,l,this.logger))(m,y).set("filename",this.id).set("paths",g).set("sourcemap",{basePath:p,comment:!1});if(C&&o.set("include css",!0),a&&o.set("hoist atrules",!0),$&&o.set("linenos",!0),r&&o.set("cache",!1),f)for(const i of f)o.include(i);if(u)for(const i of u)o.import(i);await L(o,P,l,this.logger),I(o,n);const j=await new Promise((i,x)=>{o.render((v,A)=>{v?x(v):i(A)})});for(const i of o.deps())this.deps.add(h(i));return o.sourcemap&&(o.sourcemap.sourcesContent=z(o.sourcemap,p)),{code:j,map:_(o.sourcemap).toString()??t}},test:/\.(styl|stylus)$/i};export{K as default};
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { L as Loader } from "../packem_shared/types.d-C-ij3n7X.js";
|
|
2
|
+
import 'cssnano';
|
|
3
|
+
import 'lightningcss';
|
|
4
|
+
import 'postcss';
|
|
5
|
+
import 'postcss-load-config';
|
|
6
|
+
import '@visulima/packem-share/types';
|
|
7
|
+
import 'sass';
|
|
8
|
+
import 'sass-embedded';
|
|
9
|
+
import 'stylus';
|
|
10
|
+
import '@visulima/packem-share/utils';
|
|
11
|
+
import 'rollup';
|
|
12
|
+
import 'source-map-js';
|
|
5
13
|
declare const tailwindcssLoader: Loader;
|
|
6
|
-
export default
|
|
14
|
+
export { tailwindcssLoader as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var P=Object.defineProperty;var y=(c,a)=>P(c,"name",{value:a,configurable:!0});import{stat as w}from"node:fs/promises";import{compile as $,Features as r,toSourceMap as x,optimize as E}from"@tailwindcss/node";import{clearRequireCache as T}from"@tailwindcss/node/require-cache";import{Scanner as U}from"@tailwindcss/oxide";import{findPackageJson as J}from"@visulima/package";import{resolve as C,dirname as D,relative as j,join as v,normalize as k}from"@visulima/path";import{resolveAlias as M}from"@visulima/path/utils";import{g as B}from"../packem_shared/generate-js-exports-DKOz4w8t.js";import{resolve as z}from"../packem_shared/resolve-CEc8oUE8.js";var q=Object.defineProperty,f=y((c,a)=>q(c,"name",{value:a,configurable:!0}),"h");const O=/\?[^?]*$/u,N=/[#?][^#?]*\.svg$/u,A=r.AtApply|r.JsPluginCompat|r.ThemeFunction|r.Utilities,d=f((c,a)=>(c&a)!==0,"hasFeature");class W{static{y(this,"L")}constructor(a,o,m,u,h,i){this.id=a,this.base=o,this.enableSourceMaps=m,this.customCssResolver=u,this.customJsResolver=h,this.logger=i}id;base;enableSourceMaps;customCssResolver;customJsResolver;logger;static{f(this,"TailwindRoot")}compiler;scanner;candidates=new Set;buildDependencies=new Map;async generate(a,o){const m=C(this.id.replace(O,"")),u=f(e=>{e!==m&&(N.test(e)||o(e))},"addWatchFileWrapper"),h=this.requiresBuild(),i=D(C(m));if(!this.compiler||!this.scanner||await h){T([...this.buildDependencies.keys()]),this.buildDependencies.clear(),await this.addBuildDependency(m),this.logger.debug({message:"Setup compiler"});const e=[];this.compiler=await $(a,{base:i,customCssResolver:this.customCssResolver,customJsResolver:this.customJsResolver,from:this.enableSourceMaps?this.id:void 0,onDependency:f(g=>{u(g),e.push(this.addBuildDependency(g))},"onDependency"),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 U({sources:s})}else for(const e of this.buildDependencies.keys())u(e);const l=d(this.compiler.features,A);if(this.logger.debug({data:{availableFeatures:this.compiler.features,hasAtApply:d(this.compiler.features,r.AtApply),hasJsPluginCompat:d(this.compiler.features,r.JsPluginCompat),hasRequiredFeatures:l,hasThemeFunction:d(this.compiler.features,r.ThemeFunction),hasUtilities:d(this.compiler.features,r.Utilities),requiredFeatures:A},message:"Feature analysis"}),!l)return this.logger.debug({data:{missingFeatures:{AtApply:!d(this.compiler.features,r.AtApply),JsPluginCompat:!d(this.compiler.features,r.JsPluginCompat),ThemeFunction:!d(this.compiler.features,r.ThemeFunction),Utilities:!d(this.compiler.features,r.Utilities)}},message:"Missing required features, returning false"}),!1;if(d(this.compiler.features,r.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 g of s)this.candidates.add(g);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,r.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)u(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 g=j(this.base,s.base);g[0]!=="."&&(g=`./${g}`);const R=v(g,s.pattern);this.logger.debug({data:{base:s.base,glob:s.pattern,watchPath:R},message:"Adding glob to watch list"}),u(R);const{root:S}=this.compiler;if(S!=="none"&&S!==null){const b=C(S.base,S.pattern);try{const p=await w(b);if(p.isDirectory())this.logger.debug({data:{basePath:b,isDirectory:p.isDirectory()},message:"Valid source directory confirmed"});else{const F=`The path given to \`source(…)\` must be a directory but got \`source(${b})\` instead.`;throw this.logger.debug({data:{basePath:b,error:F,isDirectory:p.isDirectory()},message:"Invalid source path detected"}),new Error(F)}}catch(p){this.logger.debug({data:{basePath:b,error:p instanceof Error?p.message:String(p)},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?x(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(a){let o;try{o=(await w(a)).mtimeMs}catch{}this.buildDependencies.set(a,o)}async requiresBuild(){for(const[a,o]of this.buildDependencies){if(o===void 0)return!0;try{if((await w(a)).mtimeMs>o)return!0}catch{return!0}}return!1}}const Z={name:"tailwindcss",async process({code:c,map:a}){const o=this.alias,m=f(async(t,n)=>{try{const e=await J(n),s=z([t,M(t,o??{})],{baseDirs:[n,v(D(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},"customCssResolver"),u=f(async(t,n)=>{try{const e=await J(n),s=z([t,M(t,o??{})],{baseDirs:[n,v(D(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},"customJsResolver");let h;this.cwd?h=this.sourceDir?v(this.cwd,this.sourceDir):this.cwd:h=this.sourceDir??process.cwd();let i=await new W(this.id,h,this.useSourcemap,m,u,this.logger).generate(c,t=>this.deps.add(k(t)));if(!i)return this.logger.debug({data:{returningOriginalContent:!0},message:"Tailwind generation returned false - not a Tailwind file or missing features"}),{code:c,map:a};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=E(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=B({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{Z as default};
|
|
@@ -1,31 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
* The minifier preserves source maps when available and provides detailed
|
|
15
|
-
* error messages for debugging minification issues.
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* // Usage in plugin configuration
|
|
19
|
-
* {
|
|
20
|
-
* minifier: cssnanoMinifier,
|
|
21
|
-
* cssnano: {
|
|
22
|
-
* preset: ['default', {
|
|
23
|
-
* discardComments: { removeAll: true },
|
|
24
|
-
* normalizeWhitespace: false
|
|
25
|
-
* }]
|
|
26
|
-
* }
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
1
|
+
import { Options } from 'cssnano';
|
|
2
|
+
import { M as Minifier } from "../packem_shared/types.d-C-ij3n7X.js";
|
|
3
|
+
import 'lightningcss';
|
|
4
|
+
import 'postcss';
|
|
5
|
+
import 'postcss-load-config';
|
|
6
|
+
import '@visulima/packem-share/types';
|
|
7
|
+
import 'sass';
|
|
8
|
+
import 'sass-embedded';
|
|
9
|
+
import 'stylus';
|
|
10
|
+
import '@visulima/packem-share/utils';
|
|
11
|
+
import 'rollup';
|
|
12
|
+
import 'source-map-js';
|
|
30
13
|
declare const cssnanoMinifier: Minifier<Options>;
|
|
31
|
-
export default
|
|
14
|
+
export { cssnanoMinifier as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"cssnano";const
|
|
1
|
+
import r from"cssnano";const i={async handler(a,e,n){const o=r(n);try{const t=e?{annotation:!1,inline:!1,prev:a.map,sourcesContent:e.content}:void 0,s=await o.process(a.css,{from:a.name,map:t,to:a.name});return{...a,css:s.css,map:e?s.map.toString():void 0}}catch(t){const s=t instanceof Error?t.message:String(t);throw new Error(`CSS minification failed for ${a.name}: ${s}`,{cause:t})}},name:"cssnano"};export{i as default};
|
|
@@ -1,30 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
* The minifier automatically converts browserslist targets to LightningCSS format
|
|
15
|
-
* and reports any warnings encountered during the minification process.
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* // Usage in plugin configuration
|
|
19
|
-
* {
|
|
20
|
-
* minifier: lightningcssMinifier,
|
|
21
|
-
* lightningcss: {
|
|
22
|
-
* targets: { chrome: 90 },
|
|
23
|
-
* unusedSymbols: ['old-class'],
|
|
24
|
-
* errorRecovery: true
|
|
25
|
-
* }
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
1
|
+
import { I as InternalStyleOptions, M as Minifier } from "../packem_shared/types.d-C-ij3n7X.js";
|
|
2
|
+
import 'cssnano';
|
|
3
|
+
import 'lightningcss';
|
|
4
|
+
import 'postcss';
|
|
5
|
+
import 'postcss-load-config';
|
|
6
|
+
import '@visulima/packem-share/types';
|
|
7
|
+
import 'sass';
|
|
8
|
+
import 'sass-embedded';
|
|
9
|
+
import 'stylus';
|
|
10
|
+
import '@visulima/packem-share/utils';
|
|
11
|
+
import 'rollup';
|
|
12
|
+
import 'source-map-js';
|
|
29
13
|
declare const lightningcssMinifier: Minifier<NonNullable<InternalStyleOptions["lightningcss"]>>;
|
|
30
|
-
export default
|
|
14
|
+
export { lightningcssMinifier as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{transform as i,browserslistToTargets as
|
|
1
|
+
import{transform as i,browserslistToTargets as o}from"lightningcss";const m={handler(e,r,a){const s=i({...a,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
2
|
${s.warnings.map(n=>n.message).join(`
|
|
3
|
-
`)}`}),{...e,css:s.code.toString(),map:"map"in s?s.map?.toString():void 0}},name:"lightningcss"};export{
|
|
3
|
+
`)}`}),Promise.resolve({...e,css:s.code.toString(),map:"map"in s?s.map?.toString():void 0})},name:"lightningcss"};export{m as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var l=Object.defineProperty;var u=(n,o)=>l(n,"name",{value:o,configurable:!0});import{SourceMapGenerator as p}from"source-map-js";import{m as f}from"./sourcemap-LKvHG-1m.js";var g=Object.defineProperty,d=u((n,o)=>g(n,"name",{value:o,configurable:!0}),"u");const h=d(n=>{const o=new p({file:""}),a=[];let s=0;for(const{css:c,map:m}of n){a.push(c);const i=f(m),r=i.toObject();if(r){const t=i.toConsumer();if(t&&(t.eachMapping(e=>{o.addMapping({generated:{column:e.generatedColumn,line:s+e.generatedLine},name:e.name,original:{column:e.originalColumn,line:e.originalLine},source:e.source})}),r.sourcesContent))for(const e of r.sources)o.setSourceContent(e,t.sourceContentFor(e,!0))}s+=c.split(`
|
|
2
|
+
`).length}return Promise.resolve({css:a.join(`
|
|
3
|
+
`),map:o})},"concat");export{h as default};
|
package/dist/packem_shared/{cssModulesTypesPlugin-CjGroK2y.js → cssModulesTypesPlugin-Bf3f6dn3.js}
RENAMED
|
@@ -6,5 +6,5 @@ var a=Object.defineProperty;var c=(s,e)=>a(s,"name",{value:e,configurable:!0});i
|
|
|
6
6
|
* Generated by packem
|
|
7
7
|
* @see https://npmjs.com/@visulima/packem
|
|
8
8
|
*/
|
|
9
|
-
`.trim()
|
|
10
|
-
${n}`),this.info({message:`Generated types for ${p(t).replace(`${e}/`,"")}`,plugin:"css-modules-types"}),this.addWatchFile(`${t}.d.ts`))}}},"cssModulesTypesPlugin");export{
|
|
9
|
+
`.trim(),$=d((s,e)=>{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(f,t){let o=i;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;n!==void 0&&await r(t)&&(await m(`${t}.d.ts`,`${g}
|
|
10
|
+
${n}`),this.info({message:`Generated types for ${p(t).replace(`${e}/`,"")}`,plugin:"css-modules-types"}),this.addWatchFile(`${t}.d.ts`))}}},"cssModulesTypesPlugin");export{$ as default};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var S=Object.defineProperty;var N=(s,t)=>S(s,"name",{value:t,configurable:!0});import{relative as J,basename as M}from"@visulima/path";import V from"./safeId-BN5akJYJ.js";var I=Object.defineProperty,x=N((s,t)=>I(s,"name",{value:t,configurable:!0}),"m");const E="css",C=new Set(["abstract","arguments","await","boolean","break","byte","case","catch","char","class","const","continue",E,"debugger","default","delete","do","double","else","enum","eval","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","let","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with","yield"]),D=x(s=>{const t=s.replaceAll(/[^\w$]/g,"_");return C.has(t)?`_${t}`:t},"getClassNameIdentifier"),B=x(({dts:s,dtsOutput:t,namedExports:e,output:n,outputExports:r})=>{if(!e)return;const o=`export {
|
|
2
|
+
${r.filter(Boolean).join(`,
|
|
3
|
+
`)}
|
|
4
|
+
};`;n.push(o),s&&t.push(o)},"appendNamedExports"),A=x(({defaultExport:s,dtsOutput:t,inject:e,modulesExports:n,modulesVariableName:r,supportModules:o})=>{o&&t.push(`
|
|
5
|
+
interface ModulesExports {
|
|
6
|
+
${Object.keys(n).map(a=>` '${a}': string;`).join(`
|
|
7
|
+
`)}
|
|
8
|
+
}
|
|
9
|
+
`,typeof e=="object"&&e.treeshakeable?"interface ModulesExports {inject:()=>void}":"",`declare const ${r}: ModulesExports;`),t.push(s)},"appendModulesDts"),_=x(({cssVariableName:s,id:t,inject:e,modulesExports:n,modulesVariableName:r,output:o,saferId:a})=>{if(typeof e=="function"){o.push(e(s,t,o),`var ${r} = ${JSON.stringify(n)};`);return}const{treeshakeable:i,...l}=typeof e=="object"?e:{},f=a("injector"),d=`${f}(${s},${JSON.stringify(l)});`,u=typeof e=="object"&&e.package?e.package:"@visulima/css-style-inject",p=typeof e=="object"&&e.method?e.method:"cssStyleInject";if(o.unshift(`import { ${p} as ${f} } from "${u}";`),!i){o.push(`var ${r} = ${JSON.stringify(n)};`,d);return}o.push("var injected = false;");const c=`if (!injected) { injected = true; ${d} }`;if(n.inject)throw new Error("`inject` keyword is reserved when using `inject.treeshakeable` option");let g="";for(const[$,h]of Object.entries(n)){const m=JSON.stringify($),j=JSON.stringify(h);g+=`get ${m}() { ${c} return ${j}; },
|
|
10
|
+
`}g+=`inject: function inject() { ${c} },`,o.push(`var ${r} = {${g}};`)},"applyInject"),w=x(({cwd:s,dts:t,dtsOutput:e,id:n,logger:r,modulesExports:o,namedExports:a,output:i,outputExports:l})=>{if(!a||Object.keys(o).length===0)return;const f=typeof a=="function"?a:D;for(const[d,u]of Object.entries(o)){const p=f(d);if(d!==p&&r){const g=s?J(s,n):n;r.warn({message:`Exported \`${d}\` as \`${p}\` in ${g}`})}const c=JSON.stringify(u);i.push(`var ${p} = ${c};`),t&&e.push(`declare const ${p}: ${c};`),l?.push(p)}},"appendClassExports"),z=x(({css:s,cssVariableName:t,cwd:e,dts:n,dtsOutput:r,id:o,logger:a,modulesExports:i,modulesVariableName:l,namedExports:f,supportModules:d})=>{const u=[`var ${t} = ${JSON.stringify(s)};`];w({cwd:e,dts:n,dtsOutput:r,id:o,logger:a,modulesExports:i,namedExports:f,output:u}),Object.keys(i).length>0&&u.push(`var ${l} = ${JSON.stringify(i)};`);const p=`
|
|
11
|
+
export default ${d?l:t};
|
|
12
|
+
`;return u.push(p),n&&(r.push(`declare const ${t}: string;`),d&&r.push(`
|
|
13
|
+
interface ModulesExports {
|
|
14
|
+
${Object.keys(i).map(c=>` '${c}': string;`).join(`
|
|
15
|
+
`)}
|
|
16
|
+
}
|
|
17
|
+
`,`declare const ${l}: ModulesExports;`),r.push(p)),{code:u.join(`
|
|
18
|
+
`),moduleSideEffects:!1,types:n?r.join(`
|
|
19
|
+
`):void 0}},"generateInlineExports"),F=x(({css:s,cwd:t,dts:e=!1,emit:n=!1,extract:r=!1,icssDependencies:o=[],id:a,inject:i,inline:l=!1,logger:f,map:d,modulesExports:u,namedExports:p,supportModules:c})=>{const g=x(k=>V(k,M(a)),"saferId"),$=g("modules"),h=[`var ${E} = ${JSON.stringify(s)};`],m=[],j=[E];if(p&&(e&&m.push(`declare const ${E}: string;`),w({cwd:t,dts:e,dtsOutput:m,id:a,logger:f,modulesExports:u,namedExports:p,output:h,outputExports:j})),l)return z({css:s,cssVariableName:E,cwd:t,dts:e,dtsOutput:m,id:a,logger:f,modulesExports:u,modulesVariableName:$,namedExports:p,supportModules:c});i&&_({cssVariableName:E,id:a,inject:i,modulesExports:u,modulesVariableName:$,output:h,saferId:g}),!i&&Object.keys(u).length>0&&h.push(`var ${$} = ${JSON.stringify(u)};`);const y=`
|
|
20
|
+
export default ${c?$:E};
|
|
21
|
+
`;h.push(y),e&&A({defaultExport:y,dtsOutput:m,inject:i,modulesExports:u,modulesVariableName:$,supportModules:c}),B({dts:e,dtsOutput:m,namedExports:p,output:h,outputExports:j});const b=h.filter(Boolean).join(`
|
|
22
|
+
`),O=m.length>0?m.filter(Boolean).join(`
|
|
23
|
+
`):void 0;if(n)return{code:s,map:d,meta:{icssDependencies:o,moduleContents:b,types:void 0},moduleSideEffects:!0};let v;return r&&(v={css:s,id:a,map:d}),{code:b,extracted:v,map:d,meta:{icssDependencies:o,moduleContents:b,types:O},moduleSideEffects:c||typeof i=="object"&&i.treeshakeable?!1:"no-treeshake",types:O}},"generateJsExports");export{F 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-LKvHG-1m.js";export{o as getMap,s as mm,i as stripMap};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var p=Object.defineProperty;var l=(n,r)=>p(n,"name",{value:r,configurable:!0});import y from"./arrayFmt-Dek5cB7m.js";import d from"./loadModule-B0QEI5Uu.js";var S=Object.defineProperty,o=l((n,r)=>S(n,"name",{value:r,configurable:!0}),"r");const u=["inject","extract","emit","inline"],O=y(u),j=o(n=>{const r=Array.isArray(n)?n:[n];if(r[0]&&!u.includes(r[0]))throw new Error(`Incorrect mode provided, allowed modes are ${O}`);const e=r[0]??"inject";let t=!1,i=!1;return e==="extract"&&(t=r[1]??!0),e==="inject"&&(i=r[1]??!0),{emit:e==="emit",extract:t,inject:i,inline:e==="inline"}},"inferModeOption"),m=o((n,r)=>typeof n=="boolean"?n&&{}:typeof n=="object"?n:r,"inferOption"),b=o(n=>{const r=Array.isArray(n)?n:[n];return r[0]?{content:!0,...r[1],inline:r[0]==="inline"}:!1},"inferSourceMapOption"),h=o((n,r)=>{const e=m(n,{});return r&&typeof e=="object"&&!e.alias&&(e.alias=r),e},"inferHandlerOption"),a=o(async(n,r,e,t)=>{if(typeof n!="string")return n;const i=await d(n,e,t);if(!i)throw new Error(`Unable to load PostCSS ${r} \`${n}\``);return i},"ensurePCSSOption"),A=o(async(n,r,e)=>{if(n===void 0)return[];if(n.length===0)return[];const t=[];for(const i of n.filter(Boolean)){if(!Array.isArray(i)){t.push(await a(i,"plugin",r,e));continue}const[s,c]=i;if(c){const f=await a(s,"plugin",r,e);t.push(f(c))}else t.push(await a(s,"plugin",r,e))}return t},"ensurePCSSPlugins");export{a as ensurePCSSOption,A as ensurePCSSPlugins,h as inferHandlerOption,j as inferModeOption,m as inferOption,b as inferSourceMapOption};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=Object.defineProperty;var u=(e,r)=>n(e,"name",{value:r,configurable:!0});import{createRequire as c}from"node:module";import{interopDefault as m,loadModule as f}from"mlly";import{resolve as p}from"./resolve-CEc8oUE8.js";var g=Object.defineProperty,i=u((e,r)=>g(e,"name",{value:r,configurable:!0}),"i");const t={},R=[".js",".mjs",".cjs",".json"],y=i(async(e,r)=>{try{return r(e)}catch(o){const s=o;if(s.code==="ERR_REQUIRE_ESM")return m(await f(e));throw s}},"loadModuleFromPath"),E=i(async(e,r,o)=>{if(t[e])return t[e];if(t[e]===null)return;const s={baseDirs:[r],caller:"Module loader",extensions:R,symlinks:!1},d=c(import.meta.url);try{const a=p([e,`./${e}`],s);if(a.startsWith("data:")){o.warn({message:`Skipping data URL module: ${e}`,module:e,plugin:"css"}),t[e]=null;return}t[e]=await y(a,d)}catch(a){o.warn({message:`Failed to resolve or load module: ${a instanceof Error?a.message:String(a)}`,module:e,plugin:"css"}),t[e]=null;return}const l=t[e];return l?.default??l},"loadModule");export{E as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a=Object.defineProperty;var l=(o,e)=>a(o,"name",{value:e,configurable:!0});import{fileURLToPath as m}from"node:url";import{dirname as f}from"@visulima/path";import{ResolverFactory as x}from"oxc-resolver";import u from"./arrayFmt-Dek5cB7m.js";var v=Object.defineProperty,c=l((o,e)=>v(o,"name",{value:e,configurable:!0}),"i");const d=f(m(import.meta.url)),b=c((o,e,s,t)=>{try{const{error:r,path:n}=o.sync(e,s);if(n)return n;r&&console.debug(r,{context:[{basedir:e,caller:t.caller,extensions:t.extensions,id:s}]})}catch(r){const n=r instanceof Error?r.message:String(r);console.debug(n,{context:[{basedir:e,caller:t.caller,error:r,extensions:t.extensions,id:s}]})}},"tryResolve"),R=c((o,e)=>{const s={baseDirs:[d],caller:"Resolver",extensions:[".mjs",".js",".cjs",".json"],symlinks:!0,...e},t=new x({extensions:s.extensions,symlinks:s.symlinks});for(const r of s.baseDirs)for(const n of o){const i=b(t,r,n,e);if(i)return i}throw new Error(`${s.caller} could not resolve ${u(o)}`)},"resolve");export{R as resolve};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var X=Object.defineProperty;var N=(e,s)=>X(e,"name",{value:s,configurable:!0});import{createFilter as Y}from"@rollup/pluginutils";import{createRollupLogger as ee}from"@visulima/packem-share/utils";import{dirname as D,normalize as I,isAbsolute as se,relative as U,resolve as te,parse as R,join as T,basename as V}from"@visulima/path";import{isRelative as oe}from"@visulima/path/utils";import ie from"p-queue";import re from"./concat-CWFnPzjp.js";import{inferSourceMapOption as ne,inferModeOption as ae,inferHandlerOption as W,inferOption as Z,ensurePCSSOption as _,ensurePCSSPlugins as ce}from"./inferModeOption-CJYqAvV-.js";import{m as B}from"./sourcemap-LKvHG-1m.js";var le=Object.defineProperty,ue=N((e,s)=>le(e,"name",{value:s,configurable:!0}),"r");const q=ue((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 pe=Object.defineProperty,de=N((e,s)=>pe(e,"name",{value:s,configurable:!0}),"a");const fe=4,me=process.env.UV_THREADPOOL_SIZE?Number.parseInt(process.env.UV_THREADPOOL_SIZE,10):fe;class ge{static{N(this,"g")}static{de(this,"LoaderManager")}test;loaders=new Map;options;workQueue;logger;constructor({extensions:s,loaders:c,logger:y,options:M}){this.test=S=>s.some(g=>S.toLowerCase().endsWith(g)),c.length>0&&this.add(...c),this.options=M,this.logger=y}add(...s){for(const c of s)this.loaders.has(c.name)||this.loaders.set(c.name,c)}isSupported(s){if(this.test(s))return!0;for(const[,c]of this.loaders)if(q(s,c.test))return!0;return!1}async process(s,c){this.workQueue??=new ie({concurrency:me-1});for(const[y,M]of this.loaders){const S={...c,options:this.options[y]??{}};if(M.alwaysProcess||q(S.id,M.test)){this.logger.debug({message:`Processing ${y} loader for ${S.id}`,plugin:"css"});try{const g=await this.workQueue.add(M.process.bind(S,s));s={...g,extracted:g.extracted??s.extracted,meta:g.meta??s.meta},this.logger.debug({message:`Completed ${y} loader for ${S.id}`,outputSize:g.code.length,plugin:"css"})}catch(g){throw this.logger.error({file:S.id,loader:y,message:`Error in ${y} loader for ${S.id}: ${g instanceof Error?g.message:String(g)}`,plugin:"css"}),g}}}return s}}var he=Object.defineProperty,P=N((e,s)=>he(e,"name",{value:s,configurable:!0}),"k");const xe=/^\.[/\\]/,ye=P((e,s)=>e.toSorted((c,y)=>s.indexOf(c.name)-s.indexOf(y.name)),"sortByNameOrder"),je=P((e,s,c,y,M,S,g,A,J)=>{const z={...J,...e.alias},G=Y(e.include,e.exclude),v=ne(e.sourceMap),i={...ae(e.mode),autoModules:e.autoModules??!1,dts:e.dts,extensions:e.extensions,namedExports:e.namedExports};let a,j,L=!1;if(e.loaders)for(const r of e.loaders)r.name==="postcss"&&(L=!0);else e.loaders=[];L&&(i.postcss={...e.postcss,config:Z(e.postcss?.config,{}),import:W(e.postcss?.import,z),modules:Z(e.postcss?.modules,void 0),to:e.postcss?.to,url:W(e.postcss?.url,z)});let E=[];const F=P((r,d)=>{const h=[];for(const o of Object.keys(r)){const u=new Set;let x=[o];do{const $=[];for(const f of x){if(u.has(f))continue;if(j.isSupported(f)){G(f)&&$.push(f);continue}u.add(f);const C=d(f);C&&$.push(...C.importedIds)}x=$}while(x.some($=>!j.isSupported($)));h.push(...x)}return h},"traverseImportedModules");return{augmentChunkHash(r){if(E.length===0)return;const d=F(r.modules,this.getModuleInfo),h=E.filter(o=>d.includes(o.id)).toSorted((o,u)=>d.lastIndexOf(o.id)-d.lastIndexOf(u.id)).map(o=>`${V(o.id)}:${o.css}`);if(h.length!==0)return h.join(":")},async buildStart(){E=[],a=ee(this,"css"),L&&i.postcss&&(e.postcss?.parser&&(i.postcss.parser=await _(e.postcss.parser,"parser",c,a)),e.postcss?.syntax&&(i.postcss.syntax=await _(e.postcss.syntax,"syntax",c,a)),e.postcss?.stringifier&&(i.postcss.stringifier=await _(e.postcss.stringifier,"stringifier",c,a)),e.postcss?.plugins&&(i.postcss.plugins=await ce(e.postcss.plugins,c,a))),j=new ge({extensions:i.extensions,loaders:ye(e.loaders??[],["sourcemap","stylus","less","sass","postcss"]),logger:a,options:{...e,...i,alias:z}}),a.info({extract:typeof i.extract=="string"?i.extract:"individual",loaders:e.loaders?.map(r=>r.name)??[],message:"CSS plugin initialized",minify:!!(A&&e.minifier),namedExports:!!i.namedExports,plugin:"css",sourceMap:S}),typeof i.inject=="object"&&i.inject.treeshakeable&&(i.namedExports=!1,a.info({message:"Disabling named exports due to `inject.treeshakeable` option",plugin:"css"}))},async generateBundle(r,d){if(E.length===0||!(r.dir||r.file))return;const h=Object.values(d),o=r.dir??D(r.file),u=h.filter(n=>n.type==="chunk"),x=u.filter(n=>!n.facadeModuleId),$=r.preserveModules?u:u.filter(n=>n.isEntry||n.isDynamicEntry),f=[],C=P(async(n,l)=>{const t=typeof i.extract=="string"?I(i.extract).replace(xe,""):I(`${n}.css`);se(t)&&this.error(["Extraction path must be relative to the output directory,",`which is ${U(c,o)}`].join(`
|
|
2
|
+
`)),oe(t)&&this.error(["Extraction path must be nested inside output directory,",`which is ${U(c,o)}`].join(`
|
|
3
|
+
`));const m=E.filter(b=>l.includes(b.id)).toSorted((b,O)=>l.lastIndexOf(b.id)-l.lastIndexOf(O.id)),w=await re(m);return{css:w.css,map:B(w.map.toString()).relative(D(te(o,t))).toString(),name:t}},"getExtractedData"),H=P(n=>{if(r.file)return R(r.file).name;if(r.preserveModules){const{dir:l,name:t}=R(n.fileName);return l?T(l,t):t}return n.name},"getName"),k=[];if(typeof i.extract=="string"){a.debug({message:`Extracting to ${i.extract}`,prefix:"css"});const n=[];for(const t of x){const m=F(t.modules,this.getModuleInfo);k.push(...m),n.push(...m)}for(const t of $)n.push(...F(t.modules,this.getModuleInfo).filter(m=>!k.includes(m)));const l=H(u[0]);f.push([l,n])}else{a.debug({message:"Extracting to individual files",prefix:"css"});for(const n of x){const l=F(n.modules,this.getModuleInfo);if(l.length===0)continue;k.push(...l);const t=H(n);f.push([t,l])}for(const n of $){const l=F(n.modules,this.getModuleInfo).filter(m=>!k.includes(m));if(l.length===0)continue;const t=H(n);f.push([t,l])}}for(const[n,l]of f){const t=await C(n,l);if(typeof e.onExtract=="function"&&!e.onExtract(t))continue;if(A&&e.minifier){a.info({message:`Minifying ${t.name} with ${e.minifier.name}`,prefix:"css"});const{css:w,map:b}=await e.minifier.handler.bind({browserTargets:s,logger:a})(t,v,e[e.minifier.name]??{});t.css=w,t.map=b}const m={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 b="assert";typeof r.assetFileNames=="string"?b=I(D(r.assetFileNames)):typeof r.assetFileNames=="function"&&(b=I(D(r.assetFileNames(m))));const O=B(t.map).modify(p=>(p.file=V(w),p)).modifySources(p=>{if(p==="<no source>"||b.length<=1)return p;p=`../${p}`;for(const Q of b)Q==="/"&&(p=`../${p}`);return p});if(v.inline)O.modify(p=>v.transform?.(p,I(T(o,w)))),m.source+=O.toCommentData(),a.debug({message:`Generated inline source map for ${w}`,plugin:"css"});else{const p=`${w}.map`;O.modify(K=>v.transform?.(K,I(T(o,p)))),this.emitFile({fileName:p,source:O.toString(),type:"asset"});const{base:Q}=R(p);m.source+=O.toCommentFile(Q),a.debug({message:`Generated external source map: ${p}`,plugin:"css"})}}this.emitFile(m),a.info({chunkIds:l.length,hasSourceMap:!!(t.map&&v),message:`Emitted CSS file: ${t.name}`,plugin:"css",size:m.source.length})}f.length>0&&a.info({filesEmitted:f.length,message:"CSS processing complete",plugin:"css",totalExtracted:E.length,totalSize:f.reduce((n,[,l])=>n+l.length,0)})},name:"rollup-plugin-css",async transform(r,d){if(!G(d)||!j.isSupported(d))return;if(r.replaceAll(/\s/g,"")===""){a.debug({message:`Skipping empty file: ${d}`,plugin:"css"});return}a.info({message:`Processing CSS file: ${d}`,plugin:"css",size:r.length}),typeof e.onImport=="function"&&e.onImport(r,d);const h={alias:z,assets:new Map,autoModules:i.autoModules,browserTargets:s,cwd:c,debug:g,deps:new Set,dts:i.dts,emit:i.emit,environment:M,extensions:i.extensions,extract:i.extract,id:d,inject:i.inject,inline:i.inline,logger:a,namedExports:i.namedExports,options:{},plugin:this,sourceDir:y,sourceMap:v,useSourcemap:S},o=await j.process({code:r},h);a.info({assets:h.assets.size,dependencies:h.deps.size,hasExtracted:!!o.extracted,message:`Processed ${d}`,outputSize:o.code.length,plugin:"css"});for(const u of h.deps)this.addWatchFile(u);for(const[u,x]of h.assets)this.emitFile({fileName:u,source:x,type:"asset"}),a.debug({message:`Emitted asset: ${u}`,plugin:"css",size:x.length});if(o.extracted){const{id:u}=o.extracted;E=E.filter(x=>x.id!==u),E.push(o.extracted),a.debug({cssSize:o.extracted.css.length,hasSourceMap:!!o.extracted.map,message:`Extracted CSS from ${u}`,plugin:"css"})}return{code:o.code,map:v&&o.map?o.map:{mappings:""},meta:{styles:o.meta},moduleSideEffects:o.extracted?!0:void 0}}}},"cssPlugin");export{je as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var m=Object.defineProperty;var a=(e,s)=>m(e,"name",{value:s,configurable:!0});import{isAccessibleSync as u,readFileSync as h}from"@visulima/fs";import{resolve as n,isAbsolute as f,relative as l,normalize as d,dirname as S}from"@visulima/path";import{SourceMapConsumer as g}from"source-map-js";const w=/\[hash(?::(\d+))?\]/,x=/(?<!^|[/\\])(\.[^\s.]+)/,M=/data:[^\n\r;]+(?:;charset=[^\n\r;]+)?;base64,([\d+/A-Za-z]+={0,2})/;var b=Object.defineProperty,t=a((e,s)=>b(e,"name",{value:s,configurable:!0}),"i");const p=/(?:\n|\r\n)?\/\*[#*@]+\s*sourceMappingURL\s*=\s*(\S+)\s*\*+\//g,c=/(?:\n|\r\n)?\/\/[#@]+\s*sourceMappingURL\s*=\s*(\S+)\s*/g;class y{static{a(this,"S")}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(r=>s(r)),this):this}resolve(s=process.cwd()){return this.modifySources(r=>r==="<no source>"?r:n(s,r))}relative(s=process.cwd()){return this.modifySources(r=>r==="<no source>"?r:f(r)?l(s,r):d(r))}toObject(){return this.map}toString(){return this.map?JSON.stringify(this.map):this.map}toConsumer(){return this.map?new g(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 O=t((e,s)=>{const[,r]=p.exec(e)??c.exec(e)??[];if(!r)return;const[,i]=M.exec(r)??[];if(i)return Buffer.from(i,"base64").toString();if(!s)throw new Error("Extracted map detected, but no ID is provided");const o=n(S(s),r);if(u(o))return h(o)},"getMap"),U=t(e=>e.replaceAll(p,"").replaceAll(c,""),"stripMap"),_=t(e=>new y(e),"mm");export{M as D,x as F,w as H,O as g,_ as m,U as s};
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { Options } from 'cssnano';
|
|
2
|
+
import { CustomAtRules, TransformOptions } from 'lightningcss';
|
|
3
|
+
import { Node, AcceptedPlugin, PluginCreator } from 'postcss';
|
|
4
|
+
import { Config } from 'postcss-load-config';
|
|
5
|
+
import { Environment } from '@visulima/packem-share/types';
|
|
6
|
+
import { StringOptions as StringOptions$1 } from 'sass';
|
|
7
|
+
import { StringOptions } from 'sass-embedded';
|
|
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
|
+
type LESSLoaderOptions = Less.Options;
|
|
13
|
+
type ImportResolve = (url: string, basedir: string, extensions: string[], atRule: Node) => Promise<string> | string;
|
|
14
|
+
interface ImportOptions {
|
|
15
|
+
alias: Record<string, string>;
|
|
16
|
+
debug?: boolean;
|
|
17
|
+
extensions: string[];
|
|
18
|
+
filter?: (id: string) => boolean;
|
|
19
|
+
load: (filename: string, importOptions: ImportOptions) => Promise<string> | string;
|
|
20
|
+
plugins: AcceptedPlugin[];
|
|
21
|
+
resolve: ImportResolve;
|
|
22
|
+
skipDuplicates?: boolean;
|
|
23
|
+
warnOnEmpty?: boolean;
|
|
24
|
+
}
|
|
25
|
+
interface ModulesOptions {
|
|
26
|
+
exportGlobals?: boolean;
|
|
27
|
+
failOnWrongOrder?: boolean;
|
|
28
|
+
generateScopedName?: string | ((name: string, file: string, css: string) => string);
|
|
29
|
+
include?: AutoModules;
|
|
30
|
+
mode?: "global" | "local" | "pure";
|
|
31
|
+
}
|
|
32
|
+
interface UrlFile {
|
|
33
|
+
from: string;
|
|
34
|
+
source: Uint8Array;
|
|
35
|
+
urlQuery?: string;
|
|
36
|
+
}
|
|
37
|
+
type UrlResolve = (inputUrl: string, baseDirectories: string[]) => Promise<UrlFile>;
|
|
38
|
+
interface UrlOptions {
|
|
39
|
+
alias?: Record<string, string>;
|
|
40
|
+
assetDir?: string | ((original: string, resolved: string, file: string) => string);
|
|
41
|
+
hash?: boolean | string;
|
|
42
|
+
inline?: boolean;
|
|
43
|
+
publicPath?: string | ((original: string, resolved: string, file: string) => string);
|
|
44
|
+
resolve?: UrlResolve;
|
|
45
|
+
}
|
|
46
|
+
type SassLoaderContext = {
|
|
47
|
+
environment: Environment;
|
|
48
|
+
resourcePath: string;
|
|
49
|
+
rootContext: string;
|
|
50
|
+
};
|
|
51
|
+
type SassLoaderOptions = (Omit<StringOptions<"sync">, "charset" | "indentedSyntax"> | Omit<StringOptions$1<"sync">, "charset" | "indentedSyntax">) & {
|
|
52
|
+
additionalData: string | ((content: string | Buffer, loaderContext: SassLoaderContext) => Promise<string>) | ((content: string | Buffer, loaderContext: SassLoaderContext) => string);
|
|
53
|
+
implementation?: "sass-embedded" | "sass";
|
|
54
|
+
warnRuleAsWarning?: boolean;
|
|
55
|
+
};
|
|
56
|
+
type StylusLoaderContext = {
|
|
57
|
+
environment: Environment;
|
|
58
|
+
resourcePath: string;
|
|
59
|
+
rootContext: string;
|
|
60
|
+
};
|
|
61
|
+
type StylusPlugin = string | ((renderer: unknown) => void);
|
|
62
|
+
type StylusDefinition = [string, unknown] | [string, unknown, boolean];
|
|
63
|
+
type StylusLoaderOptions = RenderOptions & {
|
|
64
|
+
additionalData?: string | ((content: string, loaderContext: StylusLoaderContext) => Promise<string> | string);
|
|
65
|
+
define?: Record<string, unknown> | StylusDefinition[];
|
|
66
|
+
disableCache?: boolean;
|
|
67
|
+
hoistAtrules?: boolean;
|
|
68
|
+
implementation?: string | ((code: string, options?: unknown) => unknown);
|
|
69
|
+
import?: string[];
|
|
70
|
+
include?: string[];
|
|
71
|
+
includeCSS?: boolean;
|
|
72
|
+
lineNumbers?: boolean;
|
|
73
|
+
use?: StylusPlugin[];
|
|
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
|
+
}
|
|
131
|
+
type AutoModules = RegExp | boolean | ((id: string) => boolean);
|
|
132
|
+
interface ExtractedData {
|
|
133
|
+
css: string;
|
|
134
|
+
map?: string;
|
|
135
|
+
name: string;
|
|
136
|
+
}
|
|
137
|
+
interface InjectOptions {
|
|
138
|
+
attributes?: Record<string, string>;
|
|
139
|
+
container?: string;
|
|
140
|
+
method?: string;
|
|
141
|
+
package?: string;
|
|
142
|
+
prepend?: boolean;
|
|
143
|
+
singleTag?: boolean;
|
|
144
|
+
treeshakeable?: boolean;
|
|
145
|
+
}
|
|
146
|
+
interface InternalStyleOptions extends StyleOptions {
|
|
147
|
+
emit: boolean;
|
|
148
|
+
extensions: NonNullable<StyleOptions["extensions"]>;
|
|
149
|
+
extract: boolean | string;
|
|
150
|
+
inject: InjectOptions | boolean | ((varname: string, id: string, output: string[]) => string);
|
|
151
|
+
inline: boolean;
|
|
152
|
+
}
|
|
153
|
+
type LightningCSSOptions = Omit<TransformOptions<CustomAtRules>, "code" | "cssModules" | "filename" | "minify" | "targets"> & {
|
|
154
|
+
modules?: TransformOptions<CustomAtRules>["cssModules"] & {
|
|
155
|
+
include?: AutoModules;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
interface PostCSSConfigLoaderOptions {
|
|
159
|
+
ctx?: Record<string, unknown>;
|
|
160
|
+
path?: string;
|
|
161
|
+
}
|
|
162
|
+
interface PostCSSOptions {
|
|
163
|
+
config?: PostCSSConfigLoaderOptions | false;
|
|
164
|
+
import?: Partial<ImportOptions> | false;
|
|
165
|
+
modules?: ModulesOptions | boolean;
|
|
166
|
+
parser?: Config["parser"] | string;
|
|
167
|
+
plugins?: (AcceptedPlugin | string | [PluginCreator<unknown> | string, Record<string, unknown>] | [PluginCreator<unknown> | string] | null | undefined)[] | Record<string, unknown>;
|
|
168
|
+
stringifier?: Config["stringifier"] | string;
|
|
169
|
+
syntax?: Config["syntax"] | string;
|
|
170
|
+
to?: Config["to"];
|
|
171
|
+
url?: Partial<UrlOptions> | false;
|
|
172
|
+
}
|
|
173
|
+
interface StyleOptions {
|
|
174
|
+
alias?: Record<string, string>;
|
|
175
|
+
autoModules?: AutoModules;
|
|
176
|
+
cssnano?: Options;
|
|
177
|
+
dts?: boolean;
|
|
178
|
+
exclude?: ReadonlyArray<RegExp | string> | RegExp | string;
|
|
179
|
+
extensions?: string[];
|
|
180
|
+
include?: ReadonlyArray<RegExp | string> | RegExp | string;
|
|
181
|
+
less?: LESSLoaderOptions;
|
|
182
|
+
lightningcss?: LightningCSSOptions;
|
|
183
|
+
loaders?: Loader[];
|
|
184
|
+
minifier?: Minifier;
|
|
185
|
+
mode?: "emit" | "extract" | "inject" | "inline" | ["extract", string] | ["inject", InjectOptions | ((varname: string, id: string) => string)];
|
|
186
|
+
namedExports?: boolean | ((name: string) => string);
|
|
187
|
+
onExtract?: (data: ExtractedData) => boolean;
|
|
188
|
+
onImport?: (code: string, id: string) => void;
|
|
189
|
+
postcss?: PostCSSOptions;
|
|
190
|
+
sass?: SassLoaderOptions;
|
|
191
|
+
sourceMap?: boolean | "inline" | [boolean | "inline", SourceMapOptions] | [boolean | "inline"];
|
|
192
|
+
stylus?: StylusLoaderOptions;
|
|
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 };
|