@visulima/packem 1.0.7 → 1.0.8
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 +6 -0
- package/dist/cli.mjs +2 -2
- package/dist/create-bundler.cjs +1 -1
- package/dist/create-bundler.mjs +1 -1
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## @visulima/packem [1.0.8](https://github.com/visulima/packem/compare/@visulima/packem@1.0.7...@visulima/packem@1.0.8) (2024-10-05)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* updated packem dependencies ([818e146](https://github.com/visulima/packem/commit/818e146f5414f6c9f8d3d8058fd0f034e570f99f))
|
|
6
|
+
|
|
1
7
|
## @visulima/packem [1.0.7](https://github.com/visulima/packem/compare/@visulima/packem@1.0.6...@visulima/packem@1.0.7) (2024-10-02)
|
|
2
8
|
|
|
3
9
|
### Bug Fixes
|
package/dist/cli.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
|
5
5
|
const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __cjs_path__.dirname(__filename);
|
|
7
7
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
8
|
-
const Zo="@visulima/packem",er="1.0.
|
|
8
|
+
const Zo="@visulima/packem",er="1.0.7",Ce=[".mjs",".js",".json",".node",".cjs",".ts",".cts",".mts",".tsx",".ctsx",".mtsx",".jsx"],C="production",Q="development",_e=new Set(["react-server","react-native","edge-light"]),pe=new Set([Q,C,..._e]),V=/node_modules/,J=/(?:\.d\.[mc]?tsx?|\.\w+)$/,tr="packem_chunks",or="packem_shared",H=/\.(?:m|c)?(?:j|t)sx?$/;var rr=Object.defineProperty,nr=m((e,t)=>rr(e,"name",{value:t,configurable:!0}),"a$g");const De=nr((e,t)=>e.some(o=>o instanceof RegExp?o.test(t):o===t),"arrayIncludes");var ir=Object.defineProperty,sr=m((e,t)=>ir(e,"name",{value:t,configurable:!0}),"a$f");const X=sr(e=>e==null?[]:Array.isArray(e)?e:[e],"arrayify");var ar=Object.defineProperty,lr=m((e,t)=>ar(e,"name",{value:t,configurable:!0}),"a$e");const xt=lr((e="")=>{const t=e.split("/");return t[0].startsWith("@")?t[0]+"/"+t[1]:t[0]},"getPackageName");var cr=Object.defineProperty,Et=m((e,t)=>cr(e,"name",{value:t,configurable:!0}),"s$g");const pr=Et((e,t,o)=>{const r=o??new Map;return(...n)=>{const i=t?typeof t=="function"?t(...n):t:JSON.stringify({args:n}),s=r.get(i);if(s!==void 0)return s;const a=e(...n);return r.set(i,a),a}},"memoize"),ur=Et(e=>{const t=new Map;return o=>pr(e,o,t)},"memoizeByKey");var dr=Object.defineProperty,Z=m((e,t)=>dr(e,"name",{value:t,configurable:!0}),"r$f");const mr=Z(function*(e){switch(e.declaration?.type){case"ClassDeclaration":case"FunctionDeclaration":{const{id:t}=e.declaration;ce(t,"Expected class/function to have a name"),yield t.name;break}case"VariableDeclaration":{for(const t of e.declaration.declarations)for(const o of Io(t.id))yield o;break}}},"exportName"),fr=Z(function*(e){if(e.declaration)for(const t of mr(e))yield{exportedName:t,from:"self",type:"named"};else if(e.source)yield{bindings:e.specifiers.map(t=>({exportedName:t.exported.name,importedName:t.local.name})),from:"other",source:e.source.value,type:"named"};else for(const t of e.specifiers)yield{exportedName:t.exported.name,from:"self",type:"named"}},"parseExportNamed"),gr=Z(function*(e){e.exported?yield{exportedName:e.exported.name,from:"self",type:"named"}:yield{from:"other",source:e.source.value,type:"barrel"}},"parseExportAll"),yr=Z(function*(){yield{exportedName:"default",from:"self",type:"named"}},"parseExportDefault"),hr=Z(function*(e,t){ce(t.code!=null,`Module ${t.id} doesn't have associated code`);const o=e.parse(t.code);for(const r of o.body)switch(r.type){case"ExportAllDeclaration":{yield*gr(r);break}case"ExportDefaultDeclaration":{yield*yr();break}case"ExportNamedDeclaration":{yield*fr(r);break}}},"parseExports");var vr=Object.defineProperty,ee=m((e,t)=>vr(e,"name",{value:t,configurable:!0}),"n$9");const Dt=ee(async function(e,t,o){const r=await e.resolve(t,o.id);if(ce(r,`Rollup can't resolve ${t} from ${o.id}`),r.external)return null;const n=await e.load(r);return ce(n,`Rollup doesn't have a module for id ${r.id}`),n},"getImportedModule"),br=ee(async function*(e,t,o){const r=await Dt(e,t.source,o);r&&(yield*Te(e,r))},"gatherBarrelReExports"),wr=ee(async function*(e,t,o){const r=await Dt(e,t.source,o);if(!r)return;const n=new Map(t.bindings.map(i=>[i.importedName,i]));for await(const i of Te(e,r)){const s=n.get(i.exportedName);s&&(yield{...i,exportedName:s.exportedName})}},"gatherNamedReExports"),$r=ee(async function*(e,t){yield{exportedName:t.exportedName,id:e.id,sourceName:t.exportedName}},"gatherNamedSelfExports"),Te=ee(async function*(e,t){for(const o of hr(e,t))o.from==="self"?yield*$r(t,o):o.type==="barrel"?yield*br(e,o,t):yield*wr(e,o,t)},"gatherExports");var jr=Object.defineProperty,kr=m((e,t)=>jr(e,"name",{value:t,configurable:!0}),"r$e");const xr=kr(()=>({moduleParsed:{async handler(e){if(e.isEntry)for await(const t of Te(this,e))t.id!==e.id&&this.emitFile({id:t.id,name:t.exportedName,preserveSignature:"exports-only",type:"chunk"})},order:"post"},name:"packem:chunk-splitter"}),"chunkSplitter");var Er=Object.defineProperty,Dr=m((e,t)=>Er(e,"name",{value:t,configurable:!0}),"r$d");const Sr=Dr((e,t)=>{const o=e,r=[];let n;for(;(n=o.exec(t))!==null;)n.index===o.lastIndex&&o.lastIndex++,n.forEach(i=>{r.push(i)});return r.filter(Boolean)},"getRegexMatches");var Or=Object.defineProperty,Pr=m((e,t)=>Or(e,"name",{value:t,configurable:!0}),"a$d");const St=Pr(e=>{const t=Sr(/export\s(\{\s(.*)\s\}|default\s.*);/g,e);if(t.length===0)return null;const o=t.at(-1).split(", ");let r="";for(const n of o)if(!n.includes("type")&&(n.includes("default ")&&(r=n.split("default ")[1]),n.includes("as"))){const[i,s]=n.split(" as ");s==="default"&&(r=i)}if(r!==""){const n=new F(e);return n.replace(new RegExp(`(,s)?${r} as default(,)?`),""),n.replace(new RegExp(`export default ${r};
|
|
9
9
|
?`),""),n.append(`
|
|
10
10
|
|
|
11
11
|
export = `+r+";"),{code:n.toString().replace(/export\s\{\s\s\};/,""),map:n.generateMap({hires:!0})}}return null},"patchCjsDefaultExport");var Nr=Object.defineProperty,Ue=m((e,t)=>Nr(e,"name",{value:t,configurable:!0}),"i$b");const Ot=Ue(({addDefaultProperty:e=!1,logger:t,type:o})=>({name:"packem:cjs-interop",renderChunk:Ue(async(r,n,i)=>{if(n.type!=="chunk"||!n.isEntry)return null;if(i.format==="cjs"&&i.exports==="auto"){const s=/(exports(?:\['default'\]|\.default)) = (.*);/i.exec(r);if(s===null||s.length<3)return null;const a=new F(r);a.replace("Object.defineProperty(exports, '__esModule', { value: true });",""),a.replaceAll(/exports\.(.*) = (.*);/g,"module.exports.$1 = $2;"),e&&a.append(`
|
|
@@ -105,7 +105,7 @@ The published ${g} artifact additionally contains code with the following licens
|
|
|
105
105
|
Because none of the third-party transpiler, packem uses under the hood is type-aware, some techniques or features often used in TypeScript are not properly checked and can cause mis-compilation or even runtime errors.
|
|
106
106
|
To mitigate this, you should set the isolatedModules option to true in tsconfig and let your IDE warn you when such incompatible constructs are used.`),await ds(u),u},"createContext"),Ms=N(async e=>{const t=[];if(e.options.clean)for(const o of new Set(e.options.entries.map(r=>r.outDir).filter(Boolean).sort()))o===e.options.rootDir||o===e.options.sourceDir||e.options.rootDir.startsWith(o.endsWith("/")?o:`${o}/`)||t.some(r=>o.startsWith(r))||(t.push(o),e.logger.info(`Cleaning dist directory: \`./${O(e.options.rootDir,o)}\``),await bo(o))},"cleanDistributionDirectories"),As=N(async(e,t,o)=>{if(e&&S(b(e,"keystore1.json"))){const r=Ne(b(e,"keystore.json")),n=Pe(e,{withFileTypes:!0}).filter(s=>s.isDirectory());let i=o;for await(const s of n)r[s.name]||(await po(b(e,s.name),{force:!0,recursive:!0}),i&&t.raw(`
|
|
107
107
|
|
|
108
|
-
`),t.info({message:"Removing "+s.name+" file cache, the cache key is not used anymore.",prefix:"file-cache"}),i=!1)}},"removeOldCacheFolders"),Rs=N(e=>{switch(e){case"jit":return"Stubbing";case"watch":return"Watching";case"tsdoc":return"Generating TSDoc";default:return"Building"}},"getMode"),Fs=N(async(e,t,o,r,n={})=>{const{configPath:i,debug:s,tsconfigPath:a,...l}=n;r.wrapAll(),e=$(ao(),e),r.debug("Root directory:",e);const{packageJson:c,packageJsonPath:d}=eo(e);r.debug("Using package.json found at",d);let p;if(a){const y=b(e,a);if(!await wo(y))throw new Error("tsconfig.json not found at "+y);p={config:jo(y),path:y},r.info("Using tsconfig settings at",y)}else if(c.dependencies?.typescript||c.devDependencies?.typescript)try{p=await ko(e),r.debug("Using tsconfig settings found at",p.path)}catch{r.info("No tsconfig.json or jsconfig.json found.")}const u=go("@visulima/packem",{cwd:e});let g=!1;try{let y=i??"";if(!y){const q=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"];for(const L of q)if(S(b(e,L))){y="./"+L;break}}const f=yt(e,{debug:s
|
|
108
|
+
`),t.info({message:"Removing "+s.name+" file cache, the cache key is not used anymore.",prefix:"file-cache"}),i=!1)}},"removeOldCacheFolders"),Rs=N(e=>{switch(e){case"jit":return"Stubbing";case"watch":return"Watching";case"tsdoc":return"Generating TSDoc";default:return"Building"}},"getMode"),Fs=N(async(e,t,o,r,n={})=>{const{configPath:i,debug:s,tsconfigPath:a,...l}=n;r.wrapAll(),e=$(ao(),e),r.debug("Root directory:",e);const{packageJson:c,packageJsonPath:d}=eo(e);r.debug("Using package.json found at",d);let p;if(a){const y=b(e,a);if(!await wo(y))throw new Error("tsconfig.json not found at "+y);p={config:jo(y),path:y},r.info("Using tsconfig settings at",y)}else if(c.dependencies?.typescript||c.devDependencies?.typescript)try{p=await ko(e),r.debug("Using tsconfig settings found at",p.path)}catch{r.info("No tsconfig.json or jsconfig.json found.")}const u=go("@visulima/packem",{cwd:e});let g=!1;try{let y=i??"";if(!y){const q=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"];for(const L of q)if(S(b(e,L))){y="./"+L;break}}const f=yt(e,{debug:s});if(!/\.(?:js|mjs|cjs|ts|cts|mts)$/.test(y))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");let h=await f.import(y,{default:!0,try:!0})||{};typeof h=="function"&&(h=await h(o,t)),r.debug("Using packem config found at",b(e,y));const w=M(JSON.stringify({version:c.version,...c.dependencies,...c.devDependencies,...c.peerDependencies,...c.peerDependenciesMeta,browser:c.browser,eNode:c.engines?.node,exports:c.exports,main:c.main,module:c.module,type:c.type,types:c.types}))+M(JSON.stringify(h));u&&it(w,u,r);const x=new rs(e,u,w,r),v=await Is(r,e,t,o,s??!1,l,h,c,p,f);x.isEnabled=v.options.fileCache,v.logger.info(k(Rs(t)+" "+v.options.name)),v.logger.debug({context:v.options.entries,message:`${P("Root dir:")} ${v.options.rootDir}
|
|
109
109
|
${P("Entries:")}}`}),await Ms(v);const _=Date.now(),te=N(()=>$o(Math.floor(Date.now()-_)),"getDuration");if(t==="watch"){if(v.options.rollup.watch===!1)throw new Error("Rollup watch is disabled. You should check your packem.config file.");await Gi(v,x),st(v,!1);return}if(t==="jit"?(await zi(v),await v.hooks.callHook("build:done",v)):(g=await ki(v,x),await v.hooks.callHook("validate:before",v),Ds(v),await v.hooks.callHook("validate:done",v),st(v,g)),v.options.typedoc&&v.options.typedoc.format!==void 0){let q="unknown";c.dependencies?.typedoc?q=c.dependencies.typedoc:c.devDependencies?.typedoc&&(q=c.devDependencies.typedoc),u&&it("typedoc",u,r,!0),g&&v.logger.raw(`
|
|
110
110
|
`),v.logger.info({message:"Using "+k("typedoc")+" "+q+" to generate reference documentation",prefix:"typedoc"}),await v.hooks.callHook("typedoc:before",v);let L=b(v.options.rootDir,"api-docs");v.options.typedoc.format==="inline"&&u&&(L=b(u,"typedoc")),v.options.typedoc.output&&(L=v.options.typedoc.output),await Qi(v.options.typedoc,v.options.entries,L,v.logger),await v.hooks.callHook("typedoc:done",v)}r.raw(`
|
|
111
111
|
⚡️ Build run in `+te()),r.restoreAll()}catch(y){throw r.raw(`
|
package/dist/create-bundler.cjs
CHANGED
|
@@ -98,7 +98,7 @@ The published ${y} artifact additionally contains code with the following licens
|
|
|
98
98
|
Because none of the third-party transpiler, packem uses under the hood is type-aware, some techniques or features often used in TypeScript are not properly checked and can cause mis-compilation or even runtime errors.
|
|
99
99
|
To mitigate this, you should set the isolatedModules option to true in tsconfig and let your IDE warn you when such incompatible constructs are used.`),await ji(u),u},"createContext"),Wi=N(async e=>{const t=[];if(e.options.clean)for(const o of new Set(e.options.entries.map(n=>n.outDir).filter(Boolean).sort()))o===e.options.rootDir||o===e.options.sourceDir||e.options.rootDir.startsWith(o.endsWith("/")?o:`${o}/`)||t.some(n=>o.startsWith(n))||(t.push(o),e.logger.info(`Cleaning dist directory: \`./${f.relative(e.options.rootDir,o)}\``),await E.emptyDir(o))},"cleanDistributionDirectories"),Ui=N(async(e,t,o)=>{if(e&&E.isAccessibleSync(f.join(e,"keystore1.json"))){const n=E.readJsonSync(f.join(e,"keystore.json")),r=V.readdirSync(e,{withFileTypes:!0}).filter(s=>s.isDirectory());let i=o;for await(const s of r)n[s.name]||(await se.rm(f.join(e,s.name),{force:!0,recursive:!0}),i&&t.raw(`
|
|
100
100
|
|
|
101
|
-
`),t.info({message:"Removing "+s.name+" file cache, the cache key is not used anymore.",prefix:"file-cache"}),i=!1)}},"removeOldCacheFolders"),Vi=N(e=>{switch(e){case"jit":return"Stubbing";case"watch":return"Watching";case"tsdoc":return"Generating TSDoc";default:return"Building"}},"getMode"),zi=N(async(e,t,o,n,r={})=>{const{configPath:i,debug:s,tsconfigPath:a,...l}=r;n.wrapAll(),e=f.resolve(ve.cwd(),e),n.debug("Root directory:",e);const{packageJson:c,packageJsonPath:d}=kt(e);n.debug("Using package.json found at",d);let p;if(a){const h=f.join(e,a);if(!await E.isAccessible(h))throw new Error("tsconfig.json not found at "+h);p={config:Ee.readTsConfig(h),path:h},n.info("Using tsconfig settings at",h)}else if(c.dependencies?.typescript||c.devDependencies?.typescript)try{p=await Ee.findTsConfig(e),n.debug("Using tsconfig settings found at",p.path)}catch{n.info("No tsconfig.json or jsconfig.json found.")}const u=Tt.findCacheDirSync("@visulima/packem",{cwd:e});let y=!1;try{let h=i??"";if(!h){const q=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"];for(const F of q)if(E.isAccessibleSync(f.join(e,F))){h="./"+F;break}}const g=Ue.createJiti(e,{debug:s
|
|
101
|
+
`),t.info({message:"Removing "+s.name+" file cache, the cache key is not used anymore.",prefix:"file-cache"}),i=!1)}},"removeOldCacheFolders"),Vi=N(e=>{switch(e){case"jit":return"Stubbing";case"watch":return"Watching";case"tsdoc":return"Generating TSDoc";default:return"Building"}},"getMode"),zi=N(async(e,t,o,n,r={})=>{const{configPath:i,debug:s,tsconfigPath:a,...l}=r;n.wrapAll(),e=f.resolve(ve.cwd(),e),n.debug("Root directory:",e);const{packageJson:c,packageJsonPath:d}=kt(e);n.debug("Using package.json found at",d);let p;if(a){const h=f.join(e,a);if(!await E.isAccessible(h))throw new Error("tsconfig.json not found at "+h);p={config:Ee.readTsConfig(h),path:h},n.info("Using tsconfig settings at",h)}else if(c.dependencies?.typescript||c.devDependencies?.typescript)try{p=await Ee.findTsConfig(e),n.debug("Using tsconfig settings found at",p.path)}catch{n.info("No tsconfig.json or jsconfig.json found.")}const u=Tt.findCacheDirSync("@visulima/packem",{cwd:e});let y=!1;try{let h=i??"";if(!h){const q=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"];for(const F of q)if(E.isAccessibleSync(f.join(e,F))){h="./"+F;break}}const g=Ue.createJiti(e,{debug:s});if(!/\.(?:js|mjs|cjs|ts|cts|mts)$/.test(h))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");let v=await g.import(h,{default:!0,try:!0})||{};typeof v=="function"&&(v=await v(o,t)),n.debug("Using packem config found at",f.join(e,h));const w=T(JSON.stringify({version:c.version,...c.dependencies,...c.devDependencies,...c.peerDependencies,...c.peerDependenciesMeta,browser:c.browser,eNode:c.engines?.node,exports:c.exports,main:c.main,module:c.module,type:c.type,types:c.types}))+T(JSON.stringify(v));u&&Je(w,u,n);const x=new ui(e,u,w,n),b=await Bi(n,e,t,o,s??!1,l,v,c,p,g);x.isEnabled=b.options.fileCache,b.logger.info(j.cyan(Vi(t)+" "+b.options.name)),b.logger.debug({context:b.options.entries,message:`${j.bold("Root dir:")} ${b.options.rootDir}
|
|
102
102
|
${j.bold("Entries:")}}`}),await Wi(b);const R=Date.now(),K=N(()=>P.duration(Math.floor(Date.now()-R)),"getDuration");if(t==="watch"){if(b.options.rollup.watch===!1)throw new Error("Rollup watch is disabled. You should check your packem.config file.");await ni(b,x),Le(b,!1);return}if(t==="jit"?(await Qr(b),await b.hooks.callHook("build:done",b)):(y=await Pr(b,x),await b.hooks.callHook("validate:before",b),Ti(b),await b.hooks.callHook("validate:done",b),Le(b,y)),b.options.typedoc&&b.options.typedoc.format!==void 0){let q="unknown";c.dependencies?.typedoc?q=c.dependencies.typedoc:c.devDependencies?.typedoc&&(q=c.devDependencies.typedoc),u&&Je("typedoc",u,n,!0),y&&b.logger.raw(`
|
|
103
103
|
`),b.logger.info({message:"Using "+j.cyan("typedoc")+" "+q+" to generate reference documentation",prefix:"typedoc"}),await b.hooks.callHook("typedoc:before",b);let F=f.join(b.options.rootDir,"api-docs");b.options.typedoc.format==="inline"&&u&&(F=f.join(u,"typedoc")),b.options.typedoc.output&&(F=b.options.typedoc.output),await si(b.options.typedoc,b.options.entries,F,b.logger),await b.hooks.callHook("typedoc:done",b)}n.raw(`
|
|
104
104
|
⚡️ Build run in `+K()),n.restoreAll()}catch(h){throw n.raw(`
|
package/dist/create-bundler.mjs
CHANGED
|
@@ -104,7 +104,7 @@ The published ${g} artifact additionally contains code with the following licens
|
|
|
104
104
|
Because none of the third-party transpiler, packem uses under the hood is type-aware, some techniques or features often used in TypeScript are not properly checked and can cause mis-compilation or even runtime errors.
|
|
105
105
|
To mitigate this, you should set the isolatedModules option to true in tsconfig and let your IDE warn you when such incompatible constructs are used.`),await Yi(u),u},"createContext"),bs=N(async e=>{const t=[];if(e.options.clean)for(const o of new Set(e.options.entries.map(r=>r.outDir).filter(Boolean).sort()))o===e.options.rootDir||o===e.options.sourceDir||e.options.rootDir.startsWith(o.endsWith("/")?o:`${o}/`)||t.some(r=>o.startsWith(r))||(t.push(o),e.logger.info(`Cleaning dist directory: \`./${O(e.options.rootDir,o)}\``),await so(o))},"cleanDistributionDirectories"),ws=N(async(e,t,o)=>{if(e&&P(w(e,"keystore1.json"))){const r=ke(w(e,"keystore.json")),n=$e(e,{withFileTypes:!0}).filter(s=>s.isDirectory());let i=o;for await(const s of n)r[s.name]||(await Gt(w(e,s.name),{force:!0,recursive:!0}),i&&t.raw(`
|
|
106
106
|
|
|
107
|
-
`),t.info({message:"Removing "+s.name+" file cache, the cache key is not used anymore.",prefix:"file-cache"}),i=!1)}},"removeOldCacheFolders"),$s=N(e=>{switch(e){case"jit":return"Stubbing";case"watch":return"Watching";case"tsdoc":return"Generating TSDoc";default:return"Building"}},"getMode"),ua=N(async(e,t,o,r,n={})=>{const{configPath:i,debug:s,tsconfigPath:a,...l}=n;r.wrapAll(),e=$(Qt(),e),r.debug("Root directory:",e);const{packageJson:c,packageJsonPath:d}=zt(e);r.debug("Using package.json found at",d);let p;if(a){const h=w(e,a);if(!await ao(h))throw new Error("tsconfig.json not found at "+h);p={config:co(h),path:h},r.info("Using tsconfig settings at",h)}else if(c.dependencies?.typescript||c.devDependencies?.typescript)try{p=await po(e),r.debug("Using tsconfig settings found at",p.path)}catch{r.info("No tsconfig.json or jsconfig.json found.")}const u=oo("@visulima/packem",{cwd:e});let g=!1;try{let h=i??"";if(!h){const z=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"];for(const L of z)if(P(w(e,L))){h="./"+L;break}}const f=st(e,{debug:s
|
|
107
|
+
`),t.info({message:"Removing "+s.name+" file cache, the cache key is not used anymore.",prefix:"file-cache"}),i=!1)}},"removeOldCacheFolders"),$s=N(e=>{switch(e){case"jit":return"Stubbing";case"watch":return"Watching";case"tsdoc":return"Generating TSDoc";default:return"Building"}},"getMode"),ua=N(async(e,t,o,r,n={})=>{const{configPath:i,debug:s,tsconfigPath:a,...l}=n;r.wrapAll(),e=$(Qt(),e),r.debug("Root directory:",e);const{packageJson:c,packageJsonPath:d}=zt(e);r.debug("Using package.json found at",d);let p;if(a){const h=w(e,a);if(!await ao(h))throw new Error("tsconfig.json not found at "+h);p={config:co(h),path:h},r.info("Using tsconfig settings at",h)}else if(c.dependencies?.typescript||c.devDependencies?.typescript)try{p=await po(e),r.debug("Using tsconfig settings found at",p.path)}catch{r.info("No tsconfig.json or jsconfig.json found.")}const u=oo("@visulima/packem",{cwd:e});let g=!1;try{let h=i??"";if(!h){const z=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"];for(const L of z)if(P(w(e,L))){h="./"+L;break}}const f=st(e,{debug:s});if(!/\.(?:js|mjs|cjs|ts|cts|mts)$/.test(h))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");let y=await f.import(h,{default:!0,try:!0})||{};typeof y=="function"&&(y=await y(o,t)),r.debug("Using packem config found at",w(e,h));const b=M(JSON.stringify({version:c.version,...c.dependencies,...c.devDependencies,...c.peerDependencies,...c.peerDependenciesMeta,browser:c.browser,eNode:c.engines?.node,exports:c.exports,main:c.main,module:c.module,type:c.type,types:c.types}))+M(JSON.stringify(y));u&&Ge(b,u,r);const x=new Bi(e,u,b,r),v=await vs(r,e,t,o,s??!1,l,y,c,p,f);x.isEnabled=v.options.fileCache,v.logger.info(k($s(t)+" "+v.options.name)),v.logger.debug({context:v.options.entries,message:`${D("Root dir:")} ${v.options.rootDir}
|
|
108
108
|
${D("Entries:")}}`}),await bs(v);const _=Date.now(),Q=N(()=>lo(Math.floor(Date.now()-_)),"getDuration");if(t==="watch"){if(v.options.rollup.watch===!1)throw new Error("Rollup watch is disabled. You should check your packem.config file.");await Ai(v,x),Ye(v,!1);return}if(t==="jit"?(await Di(v),await v.hooks.callHook("build:done",v)):(g=await ai(v,x),await v.hooks.callHook("validate:before",v),ps(v),await v.hooks.callHook("validate:done",v),Ye(v,g)),v.options.typedoc&&v.options.typedoc.format!==void 0){let z="unknown";c.dependencies?.typedoc?z=c.dependencies.typedoc:c.devDependencies?.typedoc&&(z=c.devDependencies.typedoc),u&&Ge("typedoc",u,r,!0),g&&v.logger.raw(`
|
|
109
109
|
`),v.logger.info({message:"Using "+k("typedoc")+" "+z+" to generate reference documentation",prefix:"typedoc"}),await v.hooks.callHook("typedoc:before",v);let L=w(v.options.rootDir,"api-docs");v.options.typedoc.format==="inline"&&u&&(L=w(u,"typedoc")),v.options.typedoc.output&&(L=v.options.typedoc.output),await Ii(v.options.typedoc,v.options.entries,L,v.logger),await v.hooks.callHook("typedoc:done",v)}r.raw(`
|
|
110
110
|
⚡️ Build run in `+Q()),r.restoreAll()}catch(h){throw r.raw(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/packem",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "A fast and modern bundler for Node.js and TypeScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
],
|
|
183
183
|
"dependencies": {
|
|
184
184
|
"@antfu/install-pkg": "0.4.1",
|
|
185
|
-
"@babel/parser": "7.25.
|
|
185
|
+
"@babel/parser": "7.25.7",
|
|
186
186
|
"@ckeditor/typedoc-plugins": "44.0.0",
|
|
187
187
|
"@clack/prompts": "0.7.0",
|
|
188
188
|
"@rollup/plugin-alias": "5.1.1",
|
|
@@ -194,21 +194,21 @@
|
|
|
194
194
|
"@rollup/plugin-replace": "6.0.1",
|
|
195
195
|
"@rollup/plugin-wasm": "6.2.2",
|
|
196
196
|
"@rollup/pluginutils": "5.1.2",
|
|
197
|
-
"@visulima/cerebro": "1.1.
|
|
198
|
-
"@visulima/colorize": "1.4.
|
|
199
|
-
"@visulima/find-cache-dir": "1.0.
|
|
200
|
-
"@visulima/fs": "2.2.
|
|
201
|
-
"@visulima/humanizer": "1.0.
|
|
202
|
-
"@visulima/package": "3.1.
|
|
203
|
-
"@visulima/pail": "2.1.
|
|
204
|
-
"@visulima/path": "1.0
|
|
205
|
-
"@visulima/tsconfig": "1.0.
|
|
197
|
+
"@visulima/cerebro": "1.1.23",
|
|
198
|
+
"@visulima/colorize": "1.4.11",
|
|
199
|
+
"@visulima/find-cache-dir": "1.0.13",
|
|
200
|
+
"@visulima/fs": "2.2.1",
|
|
201
|
+
"@visulima/humanizer": "1.0.13",
|
|
202
|
+
"@visulima/package": "3.1.3",
|
|
203
|
+
"@visulima/pail": "2.1.10",
|
|
204
|
+
"@visulima/path": "1.1.0",
|
|
205
|
+
"@visulima/tsconfig": "1.0.15",
|
|
206
206
|
"defu": "6.1.4",
|
|
207
207
|
"es-module-lexer": "1.5.4",
|
|
208
208
|
"fastest-levenshtein": "1.0.16",
|
|
209
209
|
"glob-parent": "6.0.2",
|
|
210
210
|
"hookable": "5.5.3",
|
|
211
|
-
"jiti": "2.1
|
|
211
|
+
"jiti": "2.3.1",
|
|
212
212
|
"magic-string": "0.30.11",
|
|
213
213
|
"mlly": "1.7.1",
|
|
214
214
|
"oxc-parser": "0.30.5",
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
"rollup-plugin-visualizer": "5.12.0",
|
|
220
220
|
"semver": "7.6.3",
|
|
221
221
|
"tinyglobby": "0.2.9",
|
|
222
|
-
"typedoc": "0.26.
|
|
222
|
+
"typedoc": "0.26.8",
|
|
223
223
|
"typedoc-plugin-markdown": "4.2.9",
|
|
224
224
|
"typedoc-plugin-rename-defaults": "0.7.1"
|
|
225
225
|
},
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
"@arethetypeswrong/cli": "^0.16.4",
|
|
232
232
|
"@babel/core": "^7.25.7",
|
|
233
233
|
"@rushstack/eslint-plugin-security": "^0.8.3",
|
|
234
|
-
"@secretlint/secretlint-rule-preset-recommend": "^8.2
|
|
234
|
+
"@secretlint/secretlint-rule-preset-recommend": "^8.3.2",
|
|
235
235
|
"@swc/core": "^1.7.28",
|
|
236
236
|
"@swc/types": "0.1.12",
|
|
237
237
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
@@ -263,7 +263,7 @@
|
|
|
263
263
|
"react": "^18.3.1",
|
|
264
264
|
"react-dom": "^18.3.1",
|
|
265
265
|
"rimraf": "^6.0.1",
|
|
266
|
-
"secretlint": "8.2
|
|
266
|
+
"secretlint": "8.3.2",
|
|
267
267
|
"semantic-release": "^24.1.2",
|
|
268
268
|
"sort-package-json": "^2.10.1",
|
|
269
269
|
"sucrase": "^3.35.0",
|