@visulima/packem-rollup 1.0.0-alpha.49 → 1.0.0-alpha.50
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
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## @visulima/packem-rollup [1.0.0-alpha.50](https://github.com/visulima/packem/compare/@visulima/packem-rollup@1.0.0-alpha.49...@visulima/packem-rollup@1.0.0-alpha.50) (2026-04-18)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **packem-rollup:** normalize Windows paths in isolated-declarations plugin ([6658f50](https://github.com/visulima/packem/commit/6658f50ee50acf8e518f0a3f7d898246ec85b767))
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Dependencies
|
|
9
|
+
|
|
10
|
+
* **@visulima/packem-share:** upgraded to 1.0.0-alpha.31
|
|
11
|
+
* **@visulima/rollup-plugin-dts:** upgraded to 1.0.0-alpha.11
|
|
12
|
+
|
|
1
13
|
## @visulima/packem-rollup [1.0.0-alpha.49](https://github.com/visulima/packem/compare/@visulima/packem-rollup@1.0.0-alpha.48...@visulima/packem-rollup@1.0.0-alpha.49) (2026-04-16)
|
|
2
14
|
|
|
3
15
|
### Miscellaneous Chores
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
//# sourceMappingURL=${
|
|
3
|
-
`,"appendMapUrl"),
|
|
1
|
+
var z=Object.defineProperty;var v=(t,e)=>z(t,"name",{value:e,configurable:!0});import{createFilter as J}from"@rollup/pluginutils";import{readFile as K}from"@visulima/fs";import{EXCLUDE_REGEXP as q,ENDING_REGEX as W}from"@visulima/packem-share/constants";import{getDtsExtension as B}from"@visulima/packem-share/utils";import{dirname as M,sep as O,toNamespacedPath as k,extname as A,isAbsolute as H,relative as T,join as I,basename as U}from"@visulima/path";import{parseSync as Q}from"oxc-parser";import{_ as V}from"../../packem_shared/fix-dts-default-cjs-exports-B11TKCnY.js";var Y=Object.defineProperty,Z=v((t,e)=>Y(t,"name",{value:e,configurable:!0}),"e");const R=/^([\w-]+):/,S=Z(t=>{if(!t||typeof t!="string")throw new Error("Invalid key: Key must be a non-empty string.");const e=[],p=R.exec(t);p&&(e.push(p[1]),t=t.replace(R,""));const s=t.split("/");for(const n of s)(n.includes("*")||n)&&e.push(n);return e},"splitTsconfigPathKey");var ee=Object.defineProperty,te=v((t,e)=>ee(t,"name",{value:e,configurable:!0}),"h");const re=te((t,e)=>{const p=t.replace(/^\.\//,""),s=e.replace(/^\.\//,"");if(s.startsWith(p))return t+s.slice(p.length);if(t.endsWith(e))return t;const n=S(t),g=S(e);let m=n.length-1,f=g.length-1;for(;m>=0&&f>=0&&n[m]===g[f];)m--,f--;let r=n.slice(0,m).join("/");const c=g.slice(f).join("/");return(!r.startsWith(".")||r==="")&&(r=r?`./${r}`:"."),r+(c?`/${c}`:"")},"extendString");var ie=Object.defineProperty,oe=v((t,e)=>ie(t,"name",{value:e,configurable:!0}),"s");const ae=oe((...t)=>{if(t.length===0)return"";if(t.length===1)return M(t[0]).split(O).join("/");t=t.map(n=>k(n).split(O).join("/"));const[e,...p]=t;let s=e.split("/");for(const n of p){const g=n.split("/",s.length);let m=0;for(const f of g)if(f===s[m])m+=1;else{s=s.slice(0,m);break}s=s.slice(0,m)}return s.length<=1&&s[0]===""?`/${s[0]}`:s.join("/")},"lowestCommonAncestor");var se=Object.defineProperty,j=v((t,e)=>se(t,"name",{value:e,configurable:!0}),"g");const G=j((t,e)=>`${t}
|
|
2
|
+
//# sourceMappingURL=${U(e)}.map
|
|
3
|
+
`,"appendMapUrl"),L=j((t,e,p,s)=>{let n=e;return!A(n)&&s&&(n=`${n}${s}`),JSON.stringify({file:U(p),mappings:t,names:[],sourceRoot:"",sources:[T(M(p),n)],version:3})},"generateDtsMap"),E=j(t=>O==="/"?t:t.split(O).join("/"),"toPosix"),ge=j((t,e)=>{const p=J(/\.(?:[mc]?ts|[jt]sx?)$/,e.options.rollup.isolatedDeclarations?.exclude||q),s=E(t);let n=Object.create(null);const g=j((r,c)=>{n[r.replace(W,"")]={...c,ext:A(r)}},"addOutput");let m=[];e.tsconfig?.config.compilerOptions&&(m=Object.entries(e.tsconfig.config.compilerOptions.paths??{}).map(([r])=>r.endsWith("*")?new RegExp(`^${r.replace("*","(.*)")}$`):new RegExp(`^${r}$`)));async function f(r,c){if(!p(c))return;e.logger.debug({message:`Processing file: ${c}`,prefix:"packem:isolated-declarations"});let h;try{h=Q(c,r).program}catch(a){e.logger.debug({message:a.message,prefix:"packem:isolated-declarations"})}if(h){const a=h.body.filter(i=>(i.type==="ImportDeclaration"||i.type==="ExportAllDeclaration"||i.type==="ExportNamedDeclaration")&&i.source);for await(const i of a){if(A(i.source.value)!=="")continue;const o=await this.resolve(i.source.value,c);if(!(!o||o.external)&&(o.id.endsWith(".ts")||o.id.endsWith(".cts")||o.id.endsWith(".mts")||o.id.endsWith(".tsx")||o.id.endsWith(".ctsx")||o.id.endsWith(".mtsx"))){const x=E(o.id).replace(`${s}/`,"");let y=i.source.value;m.some(b=>b.test(i.source.value))&&!i.source.value.startsWith(".")&&(y=`./${i.source.value}`);const $=re(y,x);r=r.replaceAll(`from "${i.source.value}"`,`from "${$}"`),r=r.replaceAll(`from '${i.source.value}'`,`from '${$}'`)}}}const{errors:w,map:D,sourceText:l}=await e.options.isolatedDeclarationTransformer(c,r,e.options.sourcemap,e.tsconfig?.config?.compilerOptions);if(w.length>0){if(e.options.rollup.isolatedDeclarations.ignoreErrors){this.warn(w[0]);return}return this.error(w[0])}if(!l){this.warn(`No source text generated for ${c}`);return}if(g(c,{map:D,source:l}),!h)return;const u=h.body.filter(a=>!("source"in a)||!a.source?!1:"importKind"in a&&a.importKind==="type"||"exportKind"in a&&a.exportKind==="type"?!0:a.type==="ImportDeclaration"?a.specifiers&&a.specifiers.every(i=>i.type==="ImportSpecifier"&&i.importKind==="type"):a.type==="ExportNamedDeclaration"&&a.specifiers&&a.specifiers.every(i=>i.exportKind==="type"));for await(const a of u){if(!a.source)continue;const i=await this.resolve(a.source.value,c);if(!i)return;const o=i.id;if(p(o)&&!n[o.replace(W,"")])try{const x=await K(o);await f.call(this,x,o)}catch{}}}return v(f,"E"),j(f,"transform"),{buildStart(){n=Object.create(null)},name:"packem:isolated-declarations",async renderStart(r,{input:c}){const h=ae(...Array.isArray(c)?c:Object.values(c));e.logger.debug({message:`Input base:${h}`,prefix:"packem:isolated-declarations"});const w=Array.isArray(c)?c:Object.values(c);for await(const l of w)if(p(l)&&!n[l.replace(W,"")])try{const u=await K(l);await f.call(this,u,l)}catch{}typeof r.entryFileNames=="function"&&(r.entryFileNames=r.entryFileNames({name:r.name}));const D=r.entryFileNames.replace(/\.(.)?[jt]sx?$/,(l,u)=>`.d.${u||""}ts`);for await(let[l,{ext:u,map:a,source:i}]of Object.entries(n)){let o;const x=l;if(H(l)){if(!E(l).startsWith(s)){e.logger.debug({message:`Skipping file outside sourceDirectory: ${l}`,prefix:"packem:isolated-declarations"});continue}o=E(T(t,l))}else o=E(l).replace(`${s}/`,"");if(o.startsWith("/")&&(o=o.slice(1)),e.options.rollup.cjsInterop&&r.format==="cjs"){const d=V(i,{fileName:o,imports:[]},{warn:this.warn});d&&(i=d.code)}const y=i.includes("from '")?"'":'"',$=o+u;if((e.options.declaration===!0||e.options.declaration==="compatible")&&r.format==="cjs"){e.logger.debug({message:`Emit compatible dts file: ${o}`,prefix:"packem:isolated-declarations"});const d=D.replace("[name]",k(o)).replace(".cts",".ts");let N=i;e.options.sourcemap&&a&&(N=G(N.trim(),d),this.emitFile({fileName:`${d}.map`,originalFileName:$,source:L(a,x,I(r.dir,d),u),type:"asset"})),this.emitFile({fileName:d,originalFileName:$,source:N.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(P,F,_,C)=>`${F+y+(C||_)}.d.ts${y};`),type:"asset"})}e.logger.debug({message:`Emit dts file: ${o}`,prefix:"packem:isolated-declarations"});const b=D.replace("[name]",k(o));e.options.sourcemap&&a&&(i=G(i.trim(),b),this.emitFile({fileName:`${b}.map`,originalFileName:$,source:L(a,x,I(r.dir,b),u),type:"asset"}));const X=B(e,r.format==="cjs"?"cjs":"esm");this.emitFile({fileName:b,originalFileName:$,source:i.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(d,N,P,F)=>`${N+y+(F||P)}.${X}${y};`),type:"asset"})}},transform:f}},"isolatedDeclarationsPlugin");export{ge as isolatedDeclarationsPlugin};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/packem-rollup",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.50",
|
|
4
4
|
"description": "Rollup plugins for packem",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"visulima",
|
|
@@ -158,9 +158,9 @@
|
|
|
158
158
|
"@visulima/find-cache-dir": "2.0.7",
|
|
159
159
|
"@visulima/fs": "4.1.0",
|
|
160
160
|
"@visulima/package": "4.1.7",
|
|
161
|
-
"@visulima/packem-share": "1.0.0-alpha.
|
|
161
|
+
"@visulima/packem-share": "1.0.0-alpha.31",
|
|
162
162
|
"@visulima/path": "2.0.5",
|
|
163
|
-
"@visulima/rollup-plugin-dts": "1.0.0-alpha.
|
|
163
|
+
"@visulima/rollup-plugin-dts": "1.0.0-alpha.11",
|
|
164
164
|
"@visulima/source-map": "2.0.5",
|
|
165
165
|
"cjs-module-lexer": "2.2.0",
|
|
166
166
|
"clean-css": "^5.3.3",
|