@visulima/packem 2.0.0-alpha.21 → 2.0.0-alpha.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/builder/typedoc/index.d.ts +3 -2
  3. package/dist/builder/typedoc/index.js +2 -2
  4. package/dist/cli/index.js +6 -6
  5. package/dist/config/index.d.ts +3 -2
  6. package/dist/index.d.ts +5 -4
  7. package/dist/index.js +1 -1
  8. package/dist/packem_shared/{default-DjNIGH2Y.js → default-BOtIzYpr.js} +1 -1
  9. package/dist/packem_shared/default-BSK7122E.js +1 -0
  10. package/dist/packem_shared/{default-DpHYpsSt.js → default-Gd-5cD57.js} +1 -1
  11. package/dist/packem_shared/{default-DqRcOUe1.js → default-Jms1t_Ru.js} +1 -1
  12. package/dist/packem_shared/esbuildPlugin-BrFhdKJk-ByenQxgl.js +3 -0
  13. package/dist/packem_shared/index-C56sx504.js +164 -0
  14. package/dist/packem_shared/{index-zrs6Po_w.d.ts → index-CzQ8bh8T.d.ts} +31 -8
  15. package/dist/packem_shared/isolatedDeclarationsTypescriptTransformer-DkuEkofo-OpINP11F.js +3 -0
  16. package/dist/packem_shared/oxcResolvePlugin-BJpi-eSG-Dnnq2zke.js +1 -0
  17. package/dist/packem_shared/resolveTypescriptMjsCtsPlugin-DcZrZTmM-CKlu5gDZ.js +6 -0
  18. package/dist/packem_shared/{types-5psa8MJc.d.ts → types-XVKzG-HR.d.ts} +10 -1
  19. package/dist/rollup/plugins/esbuild/index.d.ts +2 -2
  20. package/dist/rollup/plugins/esbuild/index.js +1 -1
  21. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.ts +1 -1
  22. package/dist/rollup/plugins/oxc/oxc-transformer.d.ts +1 -1
  23. package/dist/rollup/plugins/sucrase/index.d.ts +1 -1
  24. package/dist/rollup/plugins/sucrase/index.js +1 -1
  25. package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.ts +1 -1
  26. package/dist/rollup/plugins/swc/swc-plugin.d.ts +2 -2
  27. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.ts +1 -1
  28. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.js +1 -1
  29. package/package.json +15 -5
  30. package/dist/packem_shared/default-B_dUKZ_J.js +0 -1
  31. package/dist/packem_shared/esbuildPlugin-CXr7ud3R-CwR2FCHj.js +0 -3
  32. package/dist/packem_shared/index-CFFENGTN.js +0 -145
  33. package/dist/packem_shared/isolatedDeclarationsTypescriptTransformer-DkuEkofo-Cwe3ODMG.js +0 -3
  34. package/dist/packem_shared/oxcResolvePlugin-BJpi-eSG-BsYx9cDO.js +0 -1
  35. package/dist/packem_shared/resolveTypescriptMjsCtsPlugin-DcZrZTmM-BEkYWTsH.js +0 -6
@@ -6,7 +6,7 @@ import { RollupReplaceOptions } from '@rollup/plugin-replace';
6
6
  import { RollupWasmOptions } from '@rollup/plugin-wasm';
7
7
  import { FilterPattern } from '@rollup/pluginutils';
8
8
  import { RollupBuild, RollupOptions, RollupWatcher, OutputOptions, Plugin as Plugin$1 } from 'rollup';
9
- import { Options as Options$2 } from 'rollup-plugin-dts';
9
+ import { Options as Options$3 } from 'rollup-plugin-dts';
10
10
  import { NodePolyfillsOptions } from 'rollup-plugin-polyfill-node';
11
11
  import { PureAnnotationsOptions } from 'rollup-plugin-pure';
12
12
  import { PluginVisualizerOptions } from 'rollup-plugin-visualizer';
@@ -15,7 +15,7 @@ import { PackageJson } from '@visulima/package';
15
15
  import { AnsiColors as AnsiColors$1 } from '@visulima/colorize';
16
16
  import { NapiResolveOptions } from 'oxc-resolver';
17
17
  import { TransformOptions as TransformOptions$2, JsxOptions } from 'oxc-transform';
18
- import { Options as Options$3 } from 'sucrase';
18
+ import { Options as Options$4 } from 'sucrase';
19
19
 
20
20
  /**
21
21
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
@@ -2994,6 +2994,19 @@ interface RawLoaderOptions {
2994
2994
  include?: FilterPattern;
2995
2995
  }
2996
2996
 
2997
+ type Awaitable<T> = T | Promise<T>;
2998
+ type TransformFunction = (id: string, importer: string, rollupResolve: (id: string, importer?: string) => Promise<{
2999
+ id: string;
3000
+ }>) => Awaitable<boolean | undefined | void>;
3001
+ interface Options$2 {
3002
+ builtinNodeModules?: boolean;
3003
+ cwd?: string;
3004
+ exclude?: FilterPattern;
3005
+ include?: FilterPattern;
3006
+ order?: "pre" | "post" | undefined;
3007
+ shouldTransform?: string[] | TransformFunction;
3008
+ }
3009
+
2997
3010
  type ShebangOptions = {
2998
3011
  replace: boolean;
2999
3012
  shebang: string;
@@ -3047,7 +3060,7 @@ type OxcResolveOptions = Omit<NapiResolveOptions, "tsconfig"> & {
3047
3060
  ignoreSideEffectsForRoot?: boolean;
3048
3061
  };
3049
3062
 
3050
- interface SucrasePluginConfig extends Options$3 {
3063
+ interface SucrasePluginConfig extends Options$4 {
3051
3064
  exclude?: FilterPattern;
3052
3065
  include?: FilterPattern;
3053
3066
  }
@@ -3892,11 +3905,20 @@ interface ReactConfig {
3892
3905
  emitFullSignatures?: boolean;
3893
3906
  };
3894
3907
  /**
3895
- * jsx runtime
3908
+ * Decides which runtime to use when transforming JSX.
3909
+ * - `"automatic"` - Automatically imports the functions that JSX transpiles to.
3910
+ * This is the modern approach introduced in React 17+ that eliminates the need to
3911
+ * manually import React in every file that uses JSX.
3912
+ * - `"classic"` - Uses the traditional JSX transform that relies on `React.createElement`
3913
+ * calls. Requires React to be in scope, which was the standard behavior before React 17.
3914
+ * - `"preserve"` - Leaves JSX syntax unchanged without transforming it.
3915
+ * @default "classic"
3896
3916
  */
3897
- runtime?: "automatic" | "classic";
3917
+ runtime?: "automatic" | "classic" | "preserve";
3898
3918
  /**
3899
- * Declares the module specifier to be used for importing the `jsx` and `jsxs` factory functions when using `runtime` 'automatic'
3919
+ * Declares the module specifier to be used for importing the `jsx` and `jsxs` factory
3920
+ * functions when using `runtime` 'automatic'
3921
+ * @default "react"
3900
3922
  */
3901
3923
  importSource?: string;
3902
3924
  }
@@ -5189,7 +5211,7 @@ interface PackemRollupOptions {
5189
5211
  copy?: CopyPluginOptions | false;
5190
5212
  dataUri?: DataUriPluginOptions | false;
5191
5213
  debarrel?: DebarrelPluginOptions | false;
5192
- dts: Options$2;
5214
+ dts: Options$3;
5193
5215
  dynamicVars?: RollupDynamicImportVariablesOptions | false;
5194
5216
  esbuild?: Options$1 | false;
5195
5217
  experimental?: {
@@ -5213,7 +5235,8 @@ interface PackemRollupOptions {
5213
5235
  };
5214
5236
  preserveDynamicImports?: boolean;
5215
5237
  raw?: RawLoaderOptions | false;
5216
- replace: RollupReplaceOptions | false;
5238
+ replace: Omit<RollupReplaceOptions, "cwd"> | false;
5239
+ requireCJS?: Options$2 | false;
5217
5240
  resolve: RollupNodeResolveOptions | false;
5218
5241
  shebang?: Partial<ShebangOptions> | false;
5219
5242
  shim?: EsmShimCjsSyntaxOptions | false;
@@ -0,0 +1,3 @@
1
+ var m=Object.defineProperty;var p=(e,t)=>m(e,"name",{value:t,configurable:!0});const y=globalThis.process.getBuiltinModule("module").createRequire(import.meta.url),{transpileDeclaration:d,formatDiagnostics:f,sys:n}=y("typescript");var v=Object.defineProperty,N=p((e,t)=>v(e,"name",{value:t,configurable:!0}),"p"),b=Object.defineProperty,C=N((e,t)=>b(e,"name",{value:t,configurable:!0}),"l"),D=Object.defineProperty,r=C((e,t)=>D(e,"name",{value:t,configurable:!0}),"s");const M=r(e=>{const t=e.split(`
2
+ `);return t.at(-1)?.startsWith("//# sourceMappingURL=")?t.slice(0,-1).join(`
3
+ `):e},"stripMapUrl"),T=r(async(e,t,u,o)=>{const s={declarationMap:u,...o?.compilerOptions};let{diagnostics:c,outputText:i,sourceMapText:a}=d(t,{fileName:e,reportDiagnostics:!0,...o,compilerOptions:s});s.declarationMap&&(i=M(i));const g=c?.length?[f(c,{getCanonicalFileName:r(l=>n.useCaseSensitiveFileNames?l:l.toLowerCase(),"getCanonicalFileName"),getCurrentDirectory:r(()=>n.getCurrentDirectory(),"getCurrentDirectory"),getNewLine:r(()=>n.newLine,"getNewLine")})]:[];return a&&(a=JSON.parse(a).mappings),{errors:g,map:a,sourceText:i}},"isolatedDeclarationsTypescriptTransformer");export{T as v};
@@ -0,0 +1 @@
1
+ var j=Object.defineProperty;var x=(r,e)=>j(r,"name",{value:e,configurable:!0});import{createFilter as S}from"@rollup/pluginutils";import{findPackageJson as k}from"@visulima/package/package-json";import{dirname as n}from"@visulima/path";const F=globalThis.process.getBuiltinModule("module").createRequire(import.meta.url),{ResolverFactory:M}=F("oxc-resolver");var O=Object.defineProperty,_=x((r,e)=>O(r,"name",{value:e,configurable:!0}),"y"),q=Object.defineProperty,A=_((r,e)=>q(r,"name",{value:e,configurable:!0}),"g"),J=Object.defineProperty,u=A((r,e)=>J(r,"name",{value:e,configurable:!0}),"a");let y;const z=new Map,C=u((r,e,h,m)=>{const{ignoreSideEffectsForRoot:E,...a}=r;let c=y;return c||(c=y=new M({...a,roots:[...a.roots??[],e],tsconfig:m?{configFile:m,references:"auto"}:void 0})),{name:"oxc-resolve",resolveId:{async handler(v,l,{isEntry:w}){const g=w||!l?n(v):n(l),{error:p,path:o}=await c.async(g,v);if(p){h.debug(p,{context:[{basedir:e,extensions:a.extensions,id:o}]});return}let f=u(s=>!1,"hasModuleSideEffects");try{const{packageJson:s,path:P}=await k(n(o),{cache:z}),b=n(P);if(!E||e!==b){const i=s.sideEffects;if(typeof i=="boolean")f=u(()=>i,"hasModuleSideEffects");else if(Array.isArray(i)){const R=i.map(d=>d.includes("/")?d:`**/${d}`);f=S(R,void 0,{resolve:b})}}}catch(s){console.debug(s.message,{context:[{basedir:g,caller:"Resolver",error:s,extensions:a.extensions,id:o}]})}const t=await this.resolve(o,l,{skipSelf:!0});if(t)return t.external?!1:t.id!==o?t:{id:o,meta:t.meta,moduleSideEffects:f(o)}},order:"post"}}},"oxcResolvePlugin");export{C as z};
@@ -0,0 +1,6 @@
1
+ var E=Object.defineProperty;var u=(t,e)=>E(t,"name",{value:e,configurable:!0});import{parse as U}from"@babel/parser";import{findStaticImports as L}from"mlly";import{isAbsolute as Z,join as B,dirname as z,resolve as I}from"@visulima/path";import{isRelative as G}from"@visulima/path/utils";const q=globalThis.process.getBuiltinModule("module").createRequire(import.meta.url),F=q("magic-string");var H=Object.defineProperty,m=u((t,e)=>H(t,"name",{value:e,configurable:!0}),"u$1"),J=Object.defineProperty,h=m((t,e)=>J(t,"name",{value:e,configurable:!0}),"n"),K=Object.defineProperty,x=h((t,e)=>K(t,"name",{value:e,configurable:!0}),"i");let N=class{static{u(this,"y")}static{m(this,"_")}static{h(this,"WalkerBase")}static{x(this,"WalkerBase")}constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:x(()=>this.should_skip=!0,"skip"),remove:x(()=>this.should_remove=!0,"remove"),replace:x(e=>this.replacement=e,"replace")}}replace(e,s,r,n){e&&s&&(r!=null?e[s][r]=n:e[s]=n)}remove(e,s,r){e&&s&&(r!=null?e[s].splice(r,1):delete e[s])}};var Q=Object.defineProperty,g=h((t,e)=>Q(t,"name",{value:e,configurable:!0}),"c$1");let V=class extends N{static{u(this,"A")}static{m(this,"x")}static{h(this,"SyncWalker")}static{g(this,"SyncWalker")}constructor(e,s){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:g(()=>this.should_skip=!0,"skip"),remove:g(()=>this.should_remove=!0,"remove"),replace:g(r=>this.replacement=r,"replace")},this.enter=e,this.leave=s}visit(e,s,r,n){if(e){if(this.enter){const i=this.should_skip,o=this.should_remove,l=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,e,s,r,n),this.replacement&&(e=this.replacement,this.replace(s,r,n,e)),this.should_remove&&this.remove(s,r,n);const a=this.should_skip,p=this.should_remove;if(this.should_skip=i,this.should_remove=o,this.replacement=l,a)return e;if(p)return null}let c;for(c in e){const i=e[c];if(i&&typeof i=="object")if(Array.isArray(i)){const o=i;for(let l=0;l<o.length;l+=1){const a=o[l];b(a)&&(this.visit(a,e,c,l)||l--)}}else b(i)&&this.visit(i,e,c,null)}if(this.leave){const i=this.replacement,o=this.should_remove;this.replacement=null,this.should_remove=!1,this.leave.call(this.context,e,s,r,n),this.replacement&&(e=this.replacement,this.replace(s,r,n,e)),this.should_remove&&this.remove(s,r,n);const l=this.should_remove;if(this.replacement=i,this.should_remove=o,l)return null}}return e}};function b(t){return t!==null&&typeof t=="object"&&"type"in t&&typeof t.type=="string"}u(b,"d$2");m(b,"f");h(b,"n");g(b,"isNode");var X=Object.defineProperty,y=h((t,e)=>X(t,"name",{value:e,configurable:!0}),"c");let Y=class extends N{static{u(this,"P")}static{m(this,"j")}static{h(this,"AsyncWalker")}static{y(this,"AsyncWalker")}constructor(e,s){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:y(()=>this.should_skip=!0,"skip"),remove:y(()=>this.should_remove=!0,"remove"),replace:y(r=>this.replacement=r,"replace")},this.enter=e,this.leave=s}async visit(e,s,r,n){if(e){if(this.enter){const i=this.should_skip,o=this.should_remove,l=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,await this.enter.call(this.context,e,s,r,n),this.replacement&&(e=this.replacement,this.replace(s,r,n,e)),this.should_remove&&this.remove(s,r,n);const a=this.should_skip,p=this.should_remove;if(this.should_skip=i,this.should_remove=o,this.replacement=l,a)return e;if(p)return null}let c;for(c in e){const i=e[c];if(i&&typeof i=="object")if(Array.isArray(i)){const o=i;for(let l=0;l<o.length;l+=1){const a=o[l];$(a)&&(await this.visit(a,e,c,l)||l--)}}else $(i)&&await this.visit(i,e,c,null)}if(this.leave){const i=this.replacement,o=this.should_remove;this.replacement=null,this.should_remove=!1,await this.leave.call(this.context,e,s,r,n),this.replacement&&(e=this.replacement,this.replace(s,r,n,e)),this.should_remove&&this.remove(s,r,n);const l=this.should_remove;if(this.replacement=i,this.should_remove=o,l)return null}}return e}};function $(t){return t!==null&&typeof t=="object"&&"type"in t&&typeof t.type=="string"}u($,"f$2");m($,"d");h($,"a$1");y($,"isNode");var ee=Object.defineProperty,C=h((t,e)=>ee(t,"name",{value:e,configurable:!0}),"a");function j(t,{enter:e,leave:s}){return new V(e,s).visit(t,null)}u(j,"k$1");m(j,"A");h(j,"walk");C(j,"walk");async function P(t,{enter:e,leave:s}){return await new Y(e,s).visit(t,null)}u(P,"w$3");m(P,"O");h(P,"asyncWalk");C(P,"asyncWalk");var te=Object.defineProperty,A=u((t,e)=>te(t,"name",{value:e,configurable:!0}),"l$1"),se=Object.defineProperty,W=A((t,e)=>se(t,"name",{value:e,configurable:!0}),"l"),re=Object.defineProperty,d=W((t,e)=>re(t,"name",{value:e,configurable:!0}),"r");const ie=/\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g,ne=/MIT License|MIT license|BSD license/,oe=/\n{2,}/g,le=/\b(\w+)\$\d+\b/g,ae=/[-/\\^$*+?.()|[\]{}]/g,ce=d(t=>t.replaceAll(ae,String.raw`\$&`),"escapeRegex"),ue=d(t=>[...new Set(t)],"unique"),pe=d(t=>t.replaceAll(ie,e=>ne.test(e)?"":e).replaceAll(oe,`
2
+
3
+ `),"cleanUnnecessaryComments"),R=new Map;function w(t,e,{identifierReplacements:s},r){const n=L(t);for(const i in s){const o=n.find(a=>a.specifier===i&&a.imports.includes("{"));if(!o){this.warn(`${e.fileName} does not import "${i}" for replacement`),process.exitCode=1;continue}const l=s[i];for(const a in l){if(!o.imports.includes(a))throw new Error(`${e.fileName} does not import "${a}" from "${i}" for replacement`);const p=l[a],v=ce(a);p.includes(".")&&(t=t.replace(new RegExp(`\\b\\w+\\b as ${v},?\\s?`),"")),t=t.replaceAll(new RegExp(`\\b${v}\\b`,"g"),p)}}const c=ue(Array.from(t.matchAll(le),i=>i[0]));if(c.length>0){const i=c.map(l=>`
4
+ - ${l}`).join(""),o=e.fileName.replace(/\.[^/.]+$/,"");R.has(o)||r.warn({message:`${e.fileName} contains confusing identifier names${i}
5
+
6
+ To replace these, add them to the "rollup -> patchTypes -> identifierReplacements" option in your packem config.`,prefix:"plugin:patch-types"}),R.set(o,!0)}return t}u(w,"f$1");A(w,"g");W(w,"I");d(w,"replaceConfusingTypeNames");const he=d((t,e)=>{if(e.leadingComments?.some(s=>s.type==="CommentBlock"&&s.value.includes("@internal"))){const s=t.original[e.end]===","?e.end+1:e.end;return t.remove(e.leadingComments[0].start,s),!0}return!1},"removeInternal");function O(t,e){if(t.includes("@internal")){const s=new F(t),r=U(t,{plugins:["typescript"],sourceType:"module"});if(j(r,{enter(n){he(s,n)&&this.skip()}}),t=s.toString(),t.includes("@internal"))throw new Error(`${e.fileName} has unhandled @internal declarations`)}return t}u(O,"u");A(O,"h");W(O,"S");d(O,"stripInternalTypes");const He=d((t,e)=>({name:"packem:patch-types",renderChunk(s,r){return s=w.call(this,s,r,t,e),s=O.call(this,s,r),s=pe(s),s}}),"patchTypescriptTypes");var fe=Object.defineProperty,me=u((t,e)=>fe(t,"name",{value:e,configurable:!0}),"d$1"),de=Object.defineProperty,ve=me((t,e)=>de(t,"name",{value:e,configurable:!0}),"d"),ge=Object.defineProperty,f=ve((t,e)=>ge(t,"name",{value:e,configurable:!0}),"o");const ye=42,be=f(t=>{let e=!1;for(let s=0;s<t.length;s++)if(t.codePointAt(s)===ye){if(e)return!1;e=!0}return!0},"hasZeroOrOneAsteriskCharacter"),$e=f(t=>{const e=t.indexOf("*");return e===-1?void 0:{prefix:t.slice(0,e),suffix:t.slice(e+1)}},"tryParsePattern"),ke=f(({prefix:t,suffix:e},s)=>s.length>=t.length+e.length&&s.startsWith(t)&&s.endsWith(e),"isPatternMatch"),_e=f((t,e,s)=>{let r,n=-1;for(const c of t){const i=e(c);ke(i,s)&&i.prefix.length>n&&(n=i.prefix.length,r=c)}return r},"findBestPatternMatch"),xe=f((t,e)=>{const s=[];for(const r of t){if(!be(r))continue;const n=$e(r);if(n)s.push(n);else if(r===e)return r}return _e(s,r=>r,e)},"matchPatternOrExact"),je=f((t,e)=>e.substring(t.prefix.length,e.length-t.suffix.length),"matchedText"),we=f(({prefix:t,suffix:e})=>`${t}*${e}`,"patternText"),Oe=f((t,e,s)=>{let r=z(e.path);e.config.compilerOptions?.baseUrl&&(r=I(t,e.config.compilerOptions.baseUrl)),s?.debug({message:`Resolved baseUrl to ${r}`,prefix:"plugin:resolve-tsconfig-paths"});const n=e.config.compilerOptions?.paths??{};return Object.keys(n).length===0&&s?.debug({message:"No paths found in tsconfig.json",prefix:"plugin:resolve-tsconfig-paths"}),{paths:n,resolvedBaseUrl:r}},"getTsconfigPaths"),Je=f((t,e,s,r)=>{const{paths:n,resolvedBaseUrl:c}=Oe(t,e,s),i=Object.keys(n);return{name:"plugin:resolve-tsconfig-paths",async resolveId(o,l,a){if(i.length===0)return;if(o.includes("\0")){s.debug({message:`Skipping resolution of ${o} as it is a virtual module`,prefix:"plugin:resolve-tsconfig-paths"});return}if(o.includes("node_modules")){s.debug({message:`Skipping request as it is inside node_modules ${o}`,prefix:"plugin:resolve-tsconfig-paths"});return}if(!r.resolveAbsolutePath&&Z(o)){s.debug({message:`Skipping request as it is an absolute path ${o}`,prefix:"plugin:resolve-tsconfig-paths"});return}if(G(o)){s.debug({message:`Skipping request as it is a relative path ${o}`,prefix:"plugin:resolve-tsconfig-paths"});return}const p=xe(i,o);if(!p){s.debug({message:`moduleName did not match any paths pattern ${o}`,prefix:"plugin:resolve-tsconfig-paths"});return}const v=typeof p=="string"?void 0:je(p,o),D=typeof p=="string"?p:we(p);for await(const T of n[D]){const k=v?T.replace("*",v):T;if(k.endsWith(".d.ts")||k.endsWith(".d.cts")||k.endsWith(".d.mts"))continue;const S=B(c,k);try{const _=await this.resolve(S,l,{skipSelf:!0,...a});if(_)return _}catch(_){s.debug({context:[_],message:`Failed to resolve ${S} from ${o}`,prefix:"plugin:resolve-tsconfig-paths"})}}}}},"resolveTsconfigPathsPlugin");var Pe=Object.defineProperty,Ae=u((t,e)=>Pe(t,"name",{value:e,configurable:!0}),"f"),We=Object.defineProperty,Te=Ae((t,e)=>We(t,"name",{value:e,configurable:!0}),"c"),Se=Object.defineProperty,M=Te((t,e)=>Se(t,"name",{value:e,configurable:!0}),"u");const Re=M((t,e)=>{if(!e)return;const{config:s,path:r}=e;if(!s.compilerOptions)return;const{rootDirs:n}=s.compilerOptions;if(!n)return;const c=[];for(const i of n){if(i.startsWith("."))throw new Error(`Invalid rootDir value '.' in ${r}.`);if(i.startsWith(".."))throw new Error(`Invalid rootDir value '..' in ${r}.`);c.push(I(t,i))}return c},"getRootDirectories"),Ke=M((t,e,s)=>{const r=Re(t,s);return{name:"packem:resolve-tsconfig-root-dirs",async resolveId(n,c,i){if(!(r===void 0||r.length===0)&&n.startsWith("."))for(const o of r){const l=B(o,n),a=await this.resolve(l,c,{skipSelf:!0,...i});if(a)return e.debug({message:`Resolved ${n} to ${a.id} using rootDirs from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-root-dirs"}),a.id}}}},"resolveTsconfigRootDirectories");var Be=Object.defineProperty,Ie=u((t,e)=>Be(t,"name",{value:e,configurable:!0}),"t"),Ne=Object.defineProperty,Ce=Ie((t,e)=>Ne(t,"name",{value:e,configurable:!0}),"t"),Me=Object.defineProperty,De=Ce((t,e)=>Me(t,"name",{value:e,configurable:!0}),"r");const Qe=De(()=>{const t=/\.(?:[mc]?js|jsx)$/;return{name:"packem:resolve-typescript-mjs-cjs",async resolveId(e,s,r){if(t.test(e)&&s)return await this.resolve(e.replace(/js(x?)$/,"ts$1"),s,r)}}},"resolveTypescriptMjsCts");export{He as B,Ke as D,Je as N,Qe as i,j as k};
@@ -1,4 +1,5 @@
1
- import { B as BuildContext, E as Environment, R as Runtime, I as IsolatedDeclarationsTransformer, F as Format, P as PackemRollupOptions, T as TransformerFn, d as BuildHooks, g as InternalOXCTransformPluginConfig, a as TransformerName, M as Mode } from './index-zrs6Po_w.js';
1
+ import { CheckPackageOptions } from '@arethetypeswrong/core';
2
+ import { B as BuildContext, E as Environment, R as Runtime, I as IsolatedDeclarationsTransformer, F as Format, P as PackemRollupOptions, T as TransformerFn, d as BuildHooks, g as InternalOXCTransformPluginConfig, a as TransformerName, M as Mode } from './index-CzQ8bh8T.js';
2
3
  import { StyleOptions } from '@visulima/rollup-plugin-css';
3
4
  import { JitiOptions } from 'jiti';
4
5
  import { TypeDocOptions } from 'typedoc';
@@ -52,6 +53,12 @@ type ResolveExternalsPluginOptions = {
52
53
  type DeepPartial<T> = {
53
54
  [P in keyof T]?: DeepPartial<T[P]>;
54
55
  };
56
+ interface AttwOptions extends CheckPackageOptions {
57
+ ignoreScripts?: boolean;
58
+ level?: "error" | "warn";
59
+ pm?: "pnpm" | "yarn" | "npm" | "bun" | "auto";
60
+ profile?: "strict" | "node16" | "esmOnly";
61
+ }
55
62
  interface BuildConfig extends DeepPartial<Omit<BuildOptions, "entries">> {
56
63
  entries?: (BuildEntry | string)[];
57
64
  hooks?: Partial<BuildHooks<InternalBuildOptions>>;
@@ -133,6 +140,7 @@ type TypeDocumentOptions = Partial<Omit<TypeDocOptions, "entryPoints" | "hideGen
133
140
  readmePath?: string;
134
141
  };
135
142
  type ValidationOptions = {
143
+ attw?: boolean | AttwOptions;
136
144
  bundleLimit?: {
137
145
  allowFail?: boolean;
138
146
  limit?: number | `${number}${"B" | "GB" | "KB" | "MB" | "TB"}`;
@@ -157,6 +165,7 @@ type ValidationOptions = {
157
165
  main?: boolean;
158
166
  module?: boolean;
159
167
  name?: boolean;
168
+ sideEffects?: boolean;
160
169
  types?: boolean;
161
170
  typesVersions?: boolean;
162
171
  };
@@ -1,5 +1,5 @@
1
- import { T as TransformerFn } from '../../../packem_shared/index-zrs6Po_w.js';
2
- export { e as EsbuildPluginConfig } from '../../../packem_shared/index-zrs6Po_w.js';
1
+ import { T as TransformerFn } from '../../../packem_shared/index-CzQ8bh8T.js';
2
+ export { e as EsbuildPluginConfig } from '../../../packem_shared/index-CzQ8bh8T.js';
3
3
  import '@rollup/plugin-alias';
4
4
  import '@rollup/plugin-commonjs';
5
5
  import '@rollup/plugin-json';
@@ -1 +1 @@
1
- import{z as f}from"../../../packem_shared/esbuildPlugin-CXr7ud3R-CwR2FCHj.js";export{f as default};
1
+ import{z as f}from"../../../packem_shared/esbuildPlugin-BrFhdKJk-ByenQxgl.js";export{f as default};
@@ -1,5 +1,5 @@
1
1
  import { IsolatedDeclarationsOptions } from 'oxc-transform';
2
- import { f as IsolatedDeclarationsResult, T as TransformerFn } from '../../../packem_shared/index-zrs6Po_w.js';
2
+ import { f as IsolatedDeclarationsResult, T as TransformerFn } from '../../../packem_shared/index-CzQ8bh8T.js';
3
3
  import '@rollup/plugin-alias';
4
4
  import '@rollup/plugin-commonjs';
5
5
  import '@rollup/plugin-json';
@@ -1,6 +1,6 @@
1
1
  export { o as default, default as isolatedDeclarationsOxcTransformer } from './isolated-declarations-oxc-transformer.js';
2
2
  import 'oxc-transform';
3
- import '../../../packem_shared/index-zrs6Po_w.js';
3
+ import '../../../packem_shared/index-CzQ8bh8T.js';
4
4
  import '@rollup/plugin-alias';
5
5
  import '@rollup/plugin-commonjs';
6
6
  import '@rollup/plugin-json';
@@ -1,4 +1,4 @@
1
- export { h as SucrasePluginConfig, s as default } from '../../../packem_shared/index-zrs6Po_w.js';
1
+ export { h as SucrasePluginConfig, s as default } from '../../../packem_shared/index-CzQ8bh8T.js';
2
2
  import '@rollup/plugin-alias';
3
3
  import '@rollup/plugin-commonjs';
4
4
  import '@rollup/plugin-json';
@@ -1 +1 @@
1
- import{sucrasePlugin as r}from"../../../packem_shared/default-B_dUKZ_J.js";export{r as default};
1
+ import{sucrasePlugin as r}from"../../../packem_shared/default-BSK7122E.js";export{r as default};
@@ -1,5 +1,5 @@
1
1
  export { i as default } from './swc-plugin.js';
2
- import '../../../packem_shared/index-zrs6Po_w.js';
2
+ import '../../../packem_shared/index-CzQ8bh8T.js';
3
3
  import '@rollup/plugin-alias';
4
4
  import '@rollup/plugin-commonjs';
5
5
  import '@rollup/plugin-json';
@@ -1,5 +1,5 @@
1
- import { T as TransformerFn, f as IsolatedDeclarationsResult } from '../../../packem_shared/index-zrs6Po_w.js';
2
- export { S as SwcPluginConfig } from '../../../packem_shared/index-zrs6Po_w.js';
1
+ import { T as TransformerFn, f as IsolatedDeclarationsResult } from '../../../packem_shared/index-CzQ8bh8T.js';
2
+ export { S as SwcPluginConfig } from '../../../packem_shared/index-CzQ8bh8T.js';
3
3
  import '@rollup/plugin-alias';
4
4
  import '@rollup/plugin-commonjs';
5
5
  import '@rollup/plugin-json';
@@ -1,5 +1,5 @@
1
1
  import { TranspileOptions } from 'typescript';
2
- import { f as IsolatedDeclarationsResult } from '../../../packem_shared/index-zrs6Po_w.js';
2
+ import { f as IsolatedDeclarationsResult } from '../../../packem_shared/index-CzQ8bh8T.js';
3
3
  import '@rollup/plugin-alias';
4
4
  import '@rollup/plugin-commonjs';
5
5
  import '@rollup/plugin-json';
@@ -1 +1 @@
1
- import{v as f}from"../../../packem_shared/isolatedDeclarationsTypescriptTransformer-DkuEkofo-Cwe3ODMG.js";export{f as default};
1
+ import{v as f}from"../../../packem_shared/isolatedDeclarationsTypescriptTransformer-DkuEkofo-OpINP11F.js";export{f as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/packem",
3
- "version": "2.0.0-alpha.21",
3
+ "version": "2.0.0-alpha.22",
4
4
  "description": "A fast and modern bundler for Node.js and TypeScript.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -170,15 +170,17 @@
170
170
  "@visulima/find-cache-dir": "1.0.34",
171
171
  "@visulima/fs": "3.1.8",
172
172
  "@visulima/humanizer": "1.2.2",
173
- "@visulima/package": "3.5.11",
174
- "@visulima/packem-rollup": "1.0.0-alpha.16",
173
+ "@visulima/package": "3.6.1",
174
+ "@visulima/packem-rollup": "1.0.0-alpha.17",
175
175
  "@visulima/packem-share": "1.0.0-alpha.12",
176
176
  "@visulima/pail": "2.1.28",
177
177
  "@visulima/path": "1.4.0",
178
178
  "@visulima/rollup-plugin-css": "1.0.0-alpha.6",
179
179
  "@visulima/source-map": "1.0.20",
180
+ "@visulima/tabular": "^1.0.11",
180
181
  "@visulima/tsconfig": "1.1.22",
181
182
  "browserslist": "4.26.2",
183
+ "cjs-module-lexer": "^2.1.0",
182
184
  "defu": "6.1.4",
183
185
  "fastest-levenshtein": "1.0.16",
184
186
  "hookable": "5.5.3",
@@ -186,12 +188,13 @@
186
188
  "magic-string": "0.30.19",
187
189
  "mlly": "1.8.0",
188
190
  "picomatch": "4.0.3",
189
- "rollup": "4.52.0",
191
+ "rollup": "^4.52.3",
190
192
  "semver": "7.7.2",
191
193
  "tinyexec": "1.0.1",
192
194
  "tinyglobby": "0.2.15"
193
195
  },
194
196
  "peerDependencies": {
197
+ "@arethetypeswrong/core": ">=0.18.2",
195
198
  "@swc/core": ">=1.11.29",
196
199
  "@tailwindcss/node": "^4.1.13",
197
200
  "@tailwindcss/oxide": "^4.1.13",
@@ -215,9 +218,13 @@
215
218
  "typedoc": ">=0.26.0",
216
219
  "typedoc-plugin-markdown": ">=4.2.0",
217
220
  "typedoc-plugin-rename-defaults": ">=0.7.0",
218
- "typescript": ">=4.5 || >=5.0"
221
+ "typescript": ">=4.5 || >=5.0",
222
+ "package-manager-detector": "^1.3.0"
219
223
  },
220
224
  "peerDependenciesMeta": {
225
+ "@arethetypeswrong/core": {
226
+ "optional": true
227
+ },
221
228
  "@ckeditor/typedoc-plugins": {
222
229
  "optional": true
223
230
  },
@@ -292,6 +299,9 @@
292
299
  },
293
300
  "typescript": {
294
301
  "optional": true
302
+ },
303
+ "which-pm-runs": {
304
+ "optional": true
295
305
  }
296
306
  },
297
307
  "engines": {
@@ -1 +0,0 @@
1
- var m=Object.defineProperty;var n=(e,r)=>m(e,"name",{value:r,configurable:!0});import{createFilter as f}from"@rollup/pluginutils";import{f as l}from"./index-CUp9WuCG.js";import{transform as p}from"sucrase";var d=Object.defineProperty,v=n((e,r)=>d(e,"name",{value:r,configurable:!0}),"n"),b=Object.defineProperty,P=v((e,r)=>b(e,"name",{value:r,configurable:!0}),"a"),g=Object.defineProperty,y=P((e,r)=>g(e,"name",{value:r,configurable:!0}),"n");const o=y(({exclude:e,include:r,...t})=>{const c=f(r,e??l);return{name:"packem:sucrase",async transform(u,a){if(!c(a))return;const{code:s,sourceMap:i}=p(u,{...t,filePath:a,sourceMapOptions:{compiledFilename:a}});return{code:s,map:i}}}},"sucraseTransformPlugin");o.NAME="sucrase";const F=o;export{F as sucrasePlugin};
@@ -1,3 +0,0 @@
1
- var x=Object.defineProperty;var v=(e,r)=>x(e,"name",{value:r,configurable:!0});import{createFilter as O}from"@rollup/pluginutils";import{a as k}from"./index-CUp9WuCG.js";import{extname as M,join as P}from"@visulima/path";import{transform as y,formatMessages as E,build as $}from"esbuild";import{findCacheDirSync as A}from"@visulima/find-cache-dir";import{readFileSync as S}from"@visulima/fs";import*as W from"rs-module-lexer";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
2
- const require = __cjs_mod__.createRequire(import.meta.url);
3
- var C=Object.defineProperty,F=v((e,r)=>C(e,"name",{value:r,configurable:!0}),"h"),I=Object.defineProperty,f=F((e,r)=>I(e,"name",{value:r,configurable:!0}),"u"),R=Object.defineProperty,q=f((e,r)=>R(e,"name",{value:r,configurable:!0}),"n$1");const w=q(async(e,r)=>{r.length>0&&(await E(r,{color:!0,kind:"warning"})).forEach(s=>e.warn(s))},"warn");var L=Object.defineProperty,D=f((e,r)=>L(e,"name",{value:r,configurable:!0}),"t");const N=D(e=>{if(e==="es")return"esm";if(e==="cjs")return e},"getEsbuildFormat"),T=D(({sourceMap:e=!0,...r})=>async function(s,n,i){if(r.minify||r.minifyWhitespace||r.minifyIdentifiers||r.minifySyntax){const t=N(i.format),c=await y(s,{format:t,loader:"js",sourcemap:e,...r});if(await w(this,c.warnings),c.code)return{code:c.code,map:c.map||void 0}}},"getRenderChunk");var B=Object.defineProperty,j=f((e,r)=>B(e,"name",{value:r,configurable:!0}),"n");const h=j(e=>e.replaceAll("\\","/"),"slash"),G=j(async e=>{const r=A("@visulima/packem/optimize-deps",{create:!0,cwd:e.cwd});if(!r)throw new Error('[packem:optimize-deps]: failed to find or create cache directory "node_modules/.cache/packem/optimize_deps".');await $({absWorkingDir:e.cwd,bundle:!0,entryPoints:e.include,format:"esm",ignoreAnnotations:!0,metafile:!0,outdir:r,sourcemap:e.sourceMap,splitting:!0,...e.esbuildOptions,plugins:[{name:"optimize-deps",async setup(n){n.onResolve({filter:/.*/},async i=>{if(e.exclude?.includes(i.path))return{external:!0};if(!i.pluginData?.__resolving_dep_path__&&e.include.includes(i.path)){const t=await n.resolve(i.path,{kind:"import-statement",pluginData:{__resolving_dep_path__:!0},resolveDir:i.resolveDir});return t.errors.length>0||t.warnings.length>0?t:{namespace:"optimize-deps",path:i.path,pluginData:{absolute:t.path,resolveDir:i.resolveDir}}}}),n.onLoad({filter:/.*/,namespace:"optimize-deps"},async i=>{const{absolute:t,resolveDir:c}=i.pluginData,p=S(t),{output:g}=await W.parseAsync({input:[{code:p,filename:t}]});return{contents:(g[0]?.exports??[]).length>0?`export * from '${h(t)}'`:`module.exports = require('${h(t)}')`,resolveDir:c}})}},...e.esbuildOptions?.plugins??[]]});const s=new Map;for(const n of e.include)s.set(n,{file:P(r,`${n}.js`)});return{cacheDir:r,optimized:s}},"optimizeDeps");var U=Object.defineProperty,H=f((e,r)=>U(e,"name",{value:r,configurable:!0}),"g");const J=H(({exclude:e,include:r,loaders:s,logger:n,optimizeDeps:i,sourceMap:t,...c})=>{const p=k;if(s!==void 0)for(let[o,a]of Object.entries(s)){const l=o.startsWith(".")?o:`.${o}`;typeof a=="string"?p[l]=a:a||delete p[l]}const g=Object.keys(p),z=new RegExp(`\\.(${g.map(o=>o.slice(1)).join("|")})$`),_=O(r??z,e);let u,b=process.cwd();return{async buildStart(){!i||u||(u=await G({cwd:b,sourceMap:t??!1,...i}),n.debug("optimized %O",u.optimized))},name:"packem:esbuild",options({context:o}){o&&(b=o)},renderChunk:T({...c,sourceMap:t}),async resolveId(o){if(u?.optimized.has(o)){const a=u.optimized.get(o);if(a)return n.debug("resolved %s to %s",o,a.file),a.file}},async transform(o,a){if(!_(a)||u?.optimized.has(a))return;const l=M(a),d=p[l];if(n.debug("transforming %s with %s loader",a,d),!d)return;const m=await y(o,{format:["base64","binary","dataurl","text","json"].includes(d)?"esm":void 0,loader:d,sourcefile:a.replace(/\.[cm]ts/,".ts"),sourcemap:t,...c});if(await w(this,m.warnings),m.code)return{code:m.code,map:m.map||void 0}}}},"esbuildTransformer");J.NAME="esbuild";export{J as z};