@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
package/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## @visulima/packem [2.0.0-alpha.22](https://github.com/visulima/packem/compare/@visulima/packem@2.0.0-alpha.21...@visulima/packem@2.0.0-alpha.22) (2025-09-30)
2
+
3
+ ### Features
4
+
5
+ * added support for attw and publint, fixed caching issue on validation ([6f05388](https://github.com/visulima/packem/commit/6f0538802b3cd5a2cd84a373c96b25eb7fa1c01c))
6
+ * update dependencies and add requireCJS transformer support ([050ed47](https://github.com/visulima/packem/commit/050ed47cf1ced64e74e0cf5c043edd1b8f4dead1))
7
+
8
+ ### Miscellaneous Chores
9
+
10
+ * update dependencies and versions across multiple packages ([5bd26ea](https://github.com/visulima/packem/commit/5bd26ea047d62464758e5810307f6e059f5c1025))
11
+ * update dependencies and versions across multiple packages ([3e5b4a2](https://github.com/visulima/packem/commit/3e5b4a229fc514828ab9e012a5d556163b30c2fc))
12
+
13
+ ### Code Refactoring
14
+
15
+ * remove publint integration and clean up related code ([68c0215](https://github.com/visulima/packem/commit/68c021590b5224e85d0609fad39705f71323fc6b))
16
+
17
+
18
+ ### Dependencies
19
+
20
+ * **@visulima/packem-rollup:** upgraded to 1.0.0-alpha.17
21
+
1
22
  ## @visulima/packem [2.0.0-alpha.21](https://github.com/visulima/packem/compare/@visulima/packem@2.0.0-alpha.20...@visulima/packem@2.0.0-alpha.21) (2025-09-22)
2
23
 
3
24
  ### Bug Fixes
@@ -1,5 +1,5 @@
1
- import { B as BuildContext } from '../../packem_shared/index-zrs6Po_w.js';
2
- import { I as InternalBuildOptions } from '../../packem_shared/types-5psa8MJc.js';
1
+ import { B as BuildContext } from '../../packem_shared/index-CzQ8bh8T.js';
2
+ import { I as InternalBuildOptions } from '../../packem_shared/types-XVKzG-HR.js';
3
3
  import '@rollup/plugin-alias';
4
4
  import '@rollup/plugin-commonjs';
5
5
  import '@rollup/plugin-json';
@@ -18,6 +18,7 @@ import '@visulima/colorize';
18
18
  import 'oxc-resolver';
19
19
  import 'oxc-transform';
20
20
  import 'sucrase';
21
+ import '@arethetypeswrong/core';
21
22
  import '@visulima/rollup-plugin-css';
22
23
  import 'jiti';
23
24
  import 'typedoc';
@@ -1,3 +1,3 @@
1
- var j=Object.defineProperty;var g=(e,o)=>j(e,"name",{value:o,configurable:!0});import{cyan as v}from"@visulima/colorize";import{join as h}from"@visulima/path";import{p as $,d as P}from"../../packem_shared/create-or-update-key-storage-GwAIWW7R.js";import{readdirSync as A}from"node:fs";import{readFileSync as w,writeFileSync as F}from"@visulima/fs";import{Application as b}from"typedoc";var T=Object.defineProperty,_=g((e,o)=>T(e,"name",{value:o,configurable:!0}),"w");const C=_(async(e,o,a,s)=>{if(o.length===0)return;const{format:t,jsonFileName:n,marker:i,output:x,plugin:k,readmePath:p,...y}=e;if(t==="inline"&&p===void 0)throw new Error("The `readmePath` option is required when using the `inline` format.");if(t!=="inline"&&typeof p=="string"&&s.warn({message:"The `readmePath` option is only used when the `inline` format is used.",prefix:"typedoc"}),t==="json"){if(n===void 0)throw new Error("The `jsonFileName` option is required when using the `json` format.");if(!n.endsWith(".json"))throw new Error("The `jsonFileName` option must end with `.json`.")}t!=="json"&&typeof n=="string"&&s.warn({message:"The `jsonFileName` option is only used when the `json` format is used.",prefix:"typedoc"});const E=o.map(m=>m.input),u=k??[];u.push("typedoc-plugin-rename-defaults"),(t==="inline"||t==="markdown")&&u.push("typedoc-plugin-markdown");const l=await b.bootstrapWithPlugins({...y,compilerOptions:{allowJs:!0,declaration:!1,declarationMap:!1,esModuleInterop:!0,module:99,moduleResolution:100,noEmit:!0,noImplicitAny:!1,skipLibCheck:!0,sourceMap:!1,target:99,...y.compilerOptions},entryPoints:E,hideGenerator:!0,out:a,plugin:u,...t==="inline"?{hideBreadcrumbs:!0,hidePageHeader:!0,navigation:!1,outputFileStrategy:"modules",useCodeBlocks:!0}:{}},[]),d=await l.convert();if(d){if(t==="json")await l.generateJson(d,n);else if(t==="html")await l.generateDocs(d,a);else if(await l.generateOutputs(d),t==="inline"){if(i===void 0)throw new Error("The `marker` option is required when using the `inline` format.");const m=A(a,{withFileTypes:!0}).filter(r=>r.isFile());let f="";for(const r of m)r.name==="README.md"&&o.length>1||(f+=w(h(a,r.name)).replaceAll(`<!-- ${i}`,`<!-- _REPLACE_${i}`).replaceAll("<!-- ${marker}",`<!-- _REPLACE_\\${i}`));if(f!==""){const r=w(p),c=$(r,i,`
2
- ${f}`);if(!c){s.error({message:`Could not find the typedoc marker: <!-- ${i} --><!-- /${i} --> in ${p}`,prefix:"typedoc"});return}if(r===c)return;c&&F(p,c.replaceAll(`<!-- _REPLACE_${i}`,`<!-- ${i}`).replaceAll(`<!-- _REPLACE_\\${i}`,"<!-- ${marker}"),{overwrite:!0})}}}},"generateReferenceDocumentation");var R=Object.defineProperty,D=g((e,o)=>R(e,"name",{value:o,configurable:!0}),"r");const B=D(async(e,o,a,s)=>{if(e.options.typedoc&&e.options.typedoc.format!==void 0){let t="unknown";e.pkg.dependencies?.typedoc?t=e.pkg.dependencies.typedoc:e.pkg.devDependencies?.typedoc&&(t=e.pkg.devDependencies.typedoc),o&&P("typedoc",o,e.logger,!0),s&&e.logger.raw(`
1
+ var j=Object.defineProperty;var g=(e,o)=>j(e,"name",{value:o,configurable:!0});import{cyan as v}from"@visulima/colorize";import{join as h}from"@visulima/path";import{p as $,d as P}from"../../packem_shared/create-or-update-key-storage-GwAIWW7R.js";import{readFileSync as w,writeFileSync as b}from"@visulima/fs";import{Application as F}from"typedoc";const{readdirSync:A}=globalThis.process.getBuiltinModule("node:fs");var T=Object.defineProperty,_=g((e,o)=>T(e,"name",{value:o,configurable:!0}),"w");const C=_(async(e,o,a,s)=>{if(o.length===0)return;const{format:t,jsonFileName:n,marker:i,output:x,plugin:k,readmePath:p,...y}=e;if(t==="inline"&&p===void 0)throw new Error("The `readmePath` option is required when using the `inline` format.");if(t!=="inline"&&typeof p=="string"&&s.warn({message:"The `readmePath` option is only used when the `inline` format is used.",prefix:"typedoc"}),t==="json"){if(n===void 0)throw new Error("The `jsonFileName` option is required when using the `json` format.");if(!n.endsWith(".json"))throw new Error("The `jsonFileName` option must end with `.json`.")}t!=="json"&&typeof n=="string"&&s.warn({message:"The `jsonFileName` option is only used when the `json` format is used.",prefix:"typedoc"});const E=o.map(f=>f.input),u=k??[];u.push("typedoc-plugin-rename-defaults"),(t==="inline"||t==="markdown")&&u.push("typedoc-plugin-markdown");const l=await F.bootstrapWithPlugins({...y,compilerOptions:{allowJs:!0,declaration:!1,declarationMap:!1,esModuleInterop:!0,module:99,moduleResolution:100,noEmit:!0,noImplicitAny:!1,skipLibCheck:!0,sourceMap:!1,target:99,...y.compilerOptions},entryPoints:E,hideGenerator:!0,out:a,plugin:u,...t==="inline"?{hideBreadcrumbs:!0,hidePageHeader:!0,navigation:!1,outputFileStrategy:"modules",useCodeBlocks:!0}:{}},[]),d=await l.convert();if(d){if(t==="json")await l.generateJson(d,n);else if(t==="html")await l.generateDocs(d,a);else if(await l.generateOutputs(d),t==="inline"){if(i===void 0)throw new Error("The `marker` option is required when using the `inline` format.");const f=A(a,{withFileTypes:!0}).filter(r=>r.isFile());let m="";for(const r of f)r.name==="README.md"&&o.length>1||(m+=w(h(a,r.name)).replaceAll(`<!-- ${i}`,`<!-- _REPLACE_${i}`).replaceAll("<!-- ${marker}",`<!-- _REPLACE_\\${i}`));if(m!==""){const r=w(p),c=$(r,i,`
2
+ ${m}`);if(!c){s.error({message:`Could not find the typedoc marker: <!-- ${i} --><!-- /${i} --> in ${p}`,prefix:"typedoc"});return}if(r===c)return;c&&b(p,c.replaceAll(`<!-- _REPLACE_${i}`,`<!-- ${i}`).replaceAll(`<!-- _REPLACE_\\${i}`,"<!-- ${marker}"),{overwrite:!0})}}}},"generateReferenceDocumentation");var R=Object.defineProperty,D=g((e,o)=>R(e,"name",{value:o,configurable:!0}),"r");const B=D(async(e,o,a,s)=>{if(e.options.typedoc&&e.options.typedoc.format!==void 0){let t="unknown";e.pkg.dependencies?.typedoc?t=e.pkg.dependencies.typedoc:e.pkg.devDependencies?.typedoc&&(t=e.pkg.devDependencies.typedoc),o&&P("typedoc",o,e.logger,!0),s&&e.logger.raw(`
3
3
  `),e.logger.info({message:`Using ${v("typedoc")} ${t} to generate reference documentation`,prefix:"typedoc"}),await e.hooks.callHook("typedoc:before",e);let n=e.options.rootDir;e.options.typedoc.output?n=e.options.typedoc.output:e.options.typedoc.format==="inline"&&o?n=h(o,"typedoc"):e.options.typedoc.format!=="json"&&(n=h(n,"api-docs")),await C(e.options.typedoc,e.options.entries,n,e.logger),await e.hooks.callHook("typedoc:done",e)}},"builder");export{B as default};
package/dist/cli/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
- var Y=Object.defineProperty;var k=(s,t)=>Y(s,"name",{value:t,configurable:!0});import Q from"@visulima/cerebro";import{SimpleReporter as Z}from"@visulima/pail/reporter";import{cwd as A,exit as ee}from"node:process";import{installPackage as N}from"@antfu/install-pkg";import{spinner as K,select as $,multiselect as F,confirm as w,intro as se,log as G,cancel as te,outro as oe}from"@clack/prompts";import{isAccessible as ie,readFile as ne,writeFile as ae,isAccessibleSync as S,collectSync as re,writeJsonSync as le,writeFileSync as ce}from"@visulima/fs";import{join as x,resolve as M,extname as W,toNamespacedPath as pe}from"@visulima/path";import de from"magic-string";import{t as I,E as V,e as ue,N as q,_ as me,c as fe}from"../packem_shared/index-CUp9WuCG.js";import{defu as ye}from"defu";import{createJiti as ge}from"jiti";import{cyan as be,bold as O,gray as ve}from"@visulima/colorize";import{e as we,i as J,c as he,b as ke}from"../packem_shared/index-CFFENGTN.js";import{parsePackageJson as $e}from"@visulima/package/package-json";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
2
+ var Q=Object.defineProperty;var k=(s,t)=>Q(s,"name",{value:t,configurable:!0});import Z from"@visulima/cerebro";import{SimpleReporter as ee}from"@visulima/pail/reporter";import{installPackage as N}from"@antfu/install-pkg";import{spinner as K,select as $,multiselect as F,confirm as w,intro as te,log as R,cancel as oe,outro as ie}from"@clack/prompts";import{isAccessible as ne,readFile as ae,writeFile as re,isAccessibleSync as S,collectSync as le,writeJsonSync as ce,writeFileSync as pe}from"@visulima/fs";import{join as x,resolve as T,extname as W,toNamespacedPath as de}from"@visulima/path";import{t as I,E as q,e as me,N as V,_ as fe,c as ye}from"../packem_shared/index-CUp9WuCG.js";import{createJiti as be}from"jiti";import{cyan as ve,bold as O,gray as we}from"@visulima/colorize";import{e as he,i as G,c as ke,x as $e}from"../packem_shared/index-C56sx504.js";import{parsePackageJson as Se}from"@visulima/package/package-json";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
3
3
  const require = __cjs_mod__.createRequire(import.meta.url);
4
- const Se="@visulima/packem",xe="2.0.0-alpha.20";var je=Object.defineProperty,Ce=k((s,t)=>je(s,"name",{value:t,configurable:!0}),"t$2");const _=Ce(async(s,t="")=>{let e=t;if(!e){const r=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"];for(const n of r)if(await ie(x(s,n))){e=`./${n}`;break}}if(!/\.(?:js|mjs|cjs|ts|cts|mts)$/.test(e))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");return e},"findPackemFile"),X={less:["less"],lightningcss:["lightningcss"],"node-sass":["node-sass"],postcss:["postcss","postcss-load-config","postcss-modules-extract-imports","postcss-modules-local-by-default","postcss-modules-scope","postcss-modules-values","postcss-value-parser","@csstools/css-parser-algorithms","@csstools/css-tokenizer","@csstools/postcss-slow-plugins","icss-utils","@visulima/css-style-inject"],sass:["sass"],"sass-embedded":["sass-embedded"],stylus:["stylus"],tailwindcss:["@tailwindcss/node","@tailwindcss/oxide","tailwindcss"]};var Ee=Object.defineProperty,R=k((s,t)=>Ee(s,"name",{value:t,configurable:!0}),"g");const De=["typedoc","typedoc-plugin-markdown","typedoc-plugin-rename-defaults"],Pe=R(s=>{s.addCommand({argument:{description:"Add a packem feature to your project",name:"feature",required:!0},description:"Add a optional packem feature to your project",execute:R(async({argument:t,logger:e,options:r})=>{const n=K(),i=M(A(),r.dir??".");let d;try{d=await _(i,r.config)}catch{e.error("Could not find a packem config file, please run `packem init` first.");return}const f=await ne(d,{buffer:!1});let y="cjs";f.includes("import")&&(y="esm");const o=new de(f),u=" transformer,";let p=" transformer";if(f.includes(" transformer,")&&(p=" transformer,"),t.includes("typedoc")){if(f.includes("typedoc: typedocBuilder")||f.includes("@visulima/packem/builder/typedoc")){e.warn("Typedoc has already been added to the packem config.");return}y==="cjs"?o.prepend(`const typedocBuilder = require("@visulima/packem/builder/typedoc");
4
+ const _=globalThis.process.getBuiltinModule("module").createRequire(import.meta.url),{cwd:A,exit:se}=globalThis.process,ue=_("magic-string"),{defu:ge}=_("defu"),xe="@visulima/packem",je="2.0.0-alpha.21";var Ce=Object.defineProperty,Ee=k((s,t)=>Ce(s,"name",{value:t,configurable:!0}),"t$2");const X=Ee(async(s,t="")=>{let e=t;if(!e){const r=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"];for(const n of r)if(await ne(x(s,n))){e=`./${n}`;break}}if(!/\.(?:js|mjs|cjs|ts|cts|mts)$/.test(e))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");return e},"findPackemFile"),H={less:["less"],lightningcss:["lightningcss"],"node-sass":["node-sass"],postcss:["postcss","postcss-load-config","postcss-modules-extract-imports","postcss-modules-local-by-default","postcss-modules-scope","postcss-modules-values","postcss-value-parser","@csstools/css-parser-algorithms","@csstools/css-tokenizer","@csstools/postcss-slow-plugins","icss-utils","@visulima/css-style-inject"],sass:["sass"],"sass-embedded":["sass-embedded"],stylus:["stylus"],tailwindcss:["@tailwindcss/node","@tailwindcss/oxide","tailwindcss"]};var De=Object.defineProperty,J=k((s,t)=>De(s,"name",{value:t,configurable:!0}),"g");const Pe=["typedoc","typedoc-plugin-markdown","typedoc-plugin-rename-defaults"],Ie=J(s=>{s.addCommand({argument:{description:"Add a packem feature to your project",name:"feature",required:!0},description:"Add a optional packem feature to your project",execute:J(async({argument:t,logger:e,options:r})=>{const n=K(),i=T(A(),r.dir??".");let d;try{d=await X(i,r.config)}catch{e.error("Could not find a packem config file, please run `packem init` first.");return}const f=await ae(d,{buffer:!1});let y="cjs";f.includes("import")&&(y="esm");const o=new ue(f),u=" transformer,";let p=" transformer";if(f.includes(" transformer,")&&(p=" transformer,"),t.includes("typedoc")){if(f.includes("typedoc: typedocBuilder")||f.includes("@visulima/packem/builder/typedoc")){e.warn("Typedoc has already been added to the packem config.");return}y==="cjs"?o.prepend(`const typedocBuilder = require("@visulima/packem/builder/typedoc");
5
5
  `):o.prepend(`import typedocBuilder from "@visulima/packem/builder/typedoc";
6
6
  `),f.includes("builder: {")?o.replace("builder: {",`builder: {
7
7
  typedoc: typedocBuilder,
8
8
  `):o.replace(p,`${u}
9
9
  builder: {
10
10
  typedoc: typedocBuilder,
11
- },`),e.info("Adding typedoc dependencies..."),n.start("Installing packages"),await N(De,{cwd:i,dev:!0,silent:!0}),n.stop("Installed packages"),e.success(`
12
- Typedoc added!`)}if(t.includes("css")){if(f.includes("css: {")||f.includes("@visulima/packem/css")){e.warn("Css loaders have already been added to the packem config.");return}const l=[],b=await $({message:"Pick a css loader",options:[{label:"PostCSS",value:"postcss"},{hint:"experimental",label:"Lightning CSS",value:"lightningcss"},{hint:"Tailwind Css Oxide",label:"Tailwind CSS",value:"tailwindcss"}]});if(l.push(b),b!=="tailwindcss"){let m=await F({message:"Pick extra loaders",options:[{label:"Sass",value:"sass"},{label:"Stylus",value:"stylus"},{label:"Less",value:"less"}],required:!1});if(m.includes("sass")){const h=await $({message:"Pick a sass loader",options:[{hint:"recommended",label:"Sass embedded",value:"sass-embedded"},{label:"Sass",value:"sass"},{hint:"legacy",label:"Node Sass",value:"node-sass"}]});h!=="sass"&&(m=m.filter(j=>j!=="sass"),m.push(h))}l.push(...m)}const v=[];for(const m of l)v.push(...X[m]);b!=="tailwindcss"&&l.push("sourceMap");for(let m of l)(m==="sass-embedded"||m==="node-sass")&&(m="sass"),y==="cjs"?o.prepend(`const ${m}Loader = require("@visulima/packem/css/loader/${m.toLowerCase()}");
11
+ },`),e.info("Adding typedoc dependencies..."),n.start("Installing packages"),await N(Pe,{cwd:i,dev:!0,silent:!0}),n.stop("Installed packages"),e.success(`
12
+ Typedoc added!`)}if(t.includes("css")){if(f.includes("css: {")||f.includes("@visulima/packem/css")){e.warn("Css loaders have already been added to the packem config.");return}const l=[],b=await $({message:"Pick a css loader",options:[{label:"PostCSS",value:"postcss"},{hint:"experimental",label:"Lightning CSS",value:"lightningcss"},{hint:"Tailwind Css Oxide",label:"Tailwind CSS",value:"tailwindcss"}]});if(l.push(b),b!=="tailwindcss"){let m=await F({message:"Pick extra loaders",options:[{label:"Sass",value:"sass"},{label:"Stylus",value:"stylus"},{label:"Less",value:"less"}],required:!1});if(m.includes("sass")){const h=await $({message:"Pick a sass loader",options:[{hint:"recommended",label:"Sass embedded",value:"sass-embedded"},{label:"Sass",value:"sass"},{hint:"legacy",label:"Node Sass",value:"node-sass"}]});h!=="sass"&&(m=m.filter(j=>j!=="sass"),m.push(h))}l.push(...m)}const v=[];for(const m of l)v.push(...H[m]);b!=="tailwindcss"&&l.push("sourceMap");for(let m of l)(m==="sass-embedded"||m==="node-sass")&&(m="sass"),y==="cjs"?o.prepend(`const ${m}Loader = require("@visulima/packem/css/loader/${m.toLowerCase()}");
13
13
  `):o.prepend(`import ${m}Loader from "@visulima/packem/css/loader/${m.toLowerCase()}";
14
14
  `);const c=await w({initialValue:!1,message:"Do you want to minify your css?"});let a;c&&(a=await $({message:"Pick a css minifier",options:[{label:"CSSNano",value:"cssnano"},{label:"Lightning CSS",value:"lightningcss"}]}),l.includes("lightningcss")||v.push(a),y==="cjs"?o.prepend(`const ${a}Minifier = require("@visulima/packem/css/minifier/${a.toLowerCase()}");
15
15
  `):o.prepend(`import ${a}Minifier from "@visulima/packem/css/minifier/${a.toLowerCase()}";
@@ -25,7 +25,7 @@ Typedoc added!`)}if(t.includes("css")){if(f.includes("css: {")||f.includes("@vis
25
25
  loaders: [${g}],
26
26
  },
27
27
  },`),n.start("Installing packages"),await N(v,{cwd:i,dev:!0,silent:!0}),n.stop("Installed packages"),e.success(`
28
- CSS loaders added!`)}await ae(d,o.toString(),{overwrite:!0})},"execute"),name:"add",options:[{defaultValue:".",description:"The directory to build",name:"dir",type:String},{description:"Use a custom config file",name:"config",type:String}]})},"createAddCommand");var Ie=Object.defineProperty,Me=k((s,t)=>Ie(s,"name",{value:t,configurable:!0}),"e$1");const Te=Me(async(s,t,e,r,n)=>{const i=await _(t,n);let d=await s.import(i,{default:!0,try:!0})||{};return typeof d=="function"&&(d=await d(e,r)),{config:d,path:i}},"loadPackemConfig");var Be=Object.defineProperty,T=k((s,t)=>Be(s,"name",{value:t,configurable:!0}),"E$1");const Le=T((s,t)=>s.key==="exports"&&s.subKey===I?I:s.key==="exports"&&s.subKey===V?V:t,"getEnvironment"),P=T((s,t,e,r,n,i,d)=>{const f=Le(n,i.environment);let y=i.options.runtime;for(const p of ue)if(n.file.includes(`.${p}.`)||n.subKey===p){y=p;break}let o=s.find(p=>p.input===t&&p.environment===f&&p.runtime===y);o===void 0?o=s[s.push({environment:f,exportKey:new Set([n.exportKey].filter(Boolean)),input:t,runtime:y})-1]:o.exportKey&&n.exportKey&&o.exportKey.add(n.exportKey),d&&(o.isGlob=!0),e&&(o.outDir=r),n.isExecutable?(o.executable=!0,o.declaration=!1,n.type==="cjs"?o.cjs=!0:n.type==="esm"&&(o.esm=!0)):(/\.d\.[mc]?ts$/.test(n.file)&&i.options.declaration!==!1&&(o.declaration=i.options.declaration),n.type==="cjs"?o.cjs=!0:n.type==="esm"&&(o.esm=!0));const u=n.file.replace(W(n.file),"").replace(new RegExp(`^./${i.options.outDir.replace(/^\.\//,"")}/`),"");q.has(n.subKey)&&!t.includes(u)&&(o.fileAlias=u)},"createOrUpdateEntry");let U=!1;const z=T(s=>{if(s.pkg?.dependencies?.typescript===void 0&&s.pkg?.devDependencies?.typescript===void 0)throw new Error("You tried to use a `.ts`, `.cts` or `.mts` file but `typescript` was not found in your package.json.")},"validateIfTypescriptIsInstalled"),Oe=T((s,t,e)=>{const r=(e.options.outputExtensionMap?.cjs??"cjs").replaceAll(".",String.raw`\.`),n=(e.options.outputExtensionMap?.esm??"mjs").replaceAll(".",String.raw`\.`),i=[];t.sort((o,u)=>o.split("/").length-u.split("/").length);const d=s.type==="module"?"esm":"cjs";d==="esm"&&(e.options.emitESM=!0),d==="cjs"&&(e.options.emitCJS=!0);const f=we(s.exports,d,e.options.declaration,[],e.options.ignoreExportKeys).filter(o=>!o.ignored);if(s.bin){const o=(typeof s.bin=="string"?[s.bin]:Object.values(s.bin)).filter(Boolean);for(const u of o){const p=J(u);if(p&&p!==d)throw new Error(`Exported file "${u}" has an extension that does not match the package.json type "${s.type??"commonjs"}".`);f.push({file:u,isExecutable:!0,key:"bin",type:p??d})}}s.main&&f.push({file:s.main,key:"main",type:J(s.main)??d}),s.module&&f.push({file:s.module,key:"module",type:"esm"}),(s.types||s.typings)&&(z(e),e.options.declaration===void 0&&(e.options.declaration="compatible"),f.push({file:s.types??s.typings,key:"types"}));const y=[];for(const o of f){const u=W(o.file);if(u!==""&&!me.includes(u))continue;e.options.declaration===void 0&&(o.key==="types"||o.subKey==="types")&&(e.options.declaration=o.file.includes(".d.ts")?"compatible":!0),e.options.emitCJS===void 0&&o.type==="cjs"&&(e.options.emitCJS=!0),e.options.emitESM===void 0&&o.type==="esm"&&(e.options.emitESM=!0);const p=o.file.replace(new RegExp(String.raw`(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+|${[`\\.${r}`,`\\.${n}`].join("|")})$`),""),l=p.endsWith("/");if(l&&["./","/"].includes(p))continue;const b=p.replace(new RegExp(`(./)?${e.options.outDir}`),e.options.sourceDir).replace("./",""),v="(?<=/|$)",c=l?"":String.raw`(\.d\.[cm]?ts|(\.[cm]?[tj]sx?)|${[`\\.${r}`,`\\.${n}`].join("|")})$`;if(o.file.includes("/*")&&o.key==="exports"){U||(e.logger.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),U=!0);const h=[],j=new RegExp(v+b.replace("*","(.*)")+c),L=b.replace(/^(.+?)\.[^.]*$/,"$1"),H=new RegExp(v+L.replace("*","(.*)")+c);for(const C of t)(j.test(C)||q.has(o.subKey)&&H.test(C))&&h.push(C);if(h.length===0){i.push(`Could not find entrypoint for \`${o.file}\``);continue}for(const C of h)P(y,C,l,p,o,e,!0);continue}const a=new RegExp(v+b+c);let g=t.find(h=>a.test(h));if(q.has(o.subKey)&&g===void 0){const h=b.replace(/^(.+?)\.[^.]*$/,"$1"),j=new RegExp(v+h+c);g=t.find(L=>j.test(L))}if(g===void 0){S(M(e.options.rootDir,o.file))||i.push(`Could not find entrypoint for \`${o.file}\``);continue}S(g)&&/\.[cm]?tsx?$/.test(g)&&z(e);const m=pe(g.replace(fe,""));S(`${m}.cts`)&&S(`${m}.mts`)?(P(y,`${m}.cts`,l,p,{...o,type:"cjs"},e,!1),P(y,`${m}.mts`,l,p,{...o,type:"esm"},e,!1)):P(y,g,l,p,o,e,!1)}return e.options.emitESM&&!e.options.emitCJS&&e.options.declaration===void 0&&(e.options.declaration="node16"),{entries:y,warnings:i}},"inferEntries");var Ne=Object.defineProperty,Ke=k((s,t)=>Ne(s,"name",{value:t,configurable:!0}),"o");const Ve=Ke((s,t)=>{const{publishConfig:e}=s;return e&&(e.bin&&(typeof e.bin=="object"||typeof e.bin=="string")&&(s.bin=e.bin),e.type&&typeof e.type=="string"&&e.type!==""&&(s.type=e.type),e.main&&typeof e.main=="string"&&e.main!==""&&(s.main=e.main),e.module&&typeof e.module=="string"&&e.module!==""&&(s.module=e.module),t===void 0&&e.types&&typeof e.types=="string"&&e.types!==""?s.types=e.types:t===void 0&&e.typings&&typeof e.typings=="string"&&e.typings!==""&&(s.typings=e.typings),e.exports&&typeof e.exports=="object"&&(s.exports=e.exports)),s},"overwriteWithPublishConfig");var qe=Object.defineProperty,Ae=k((s,t)=>qe(s,"name",{value:t,configurable:!0}),"t$1");const Ge={hooks:{"build:prepare":Ae(function(s){if(s.options.entries.length>0)return;const t=x(s.options.rootDir,s.options.sourceDir);if(!S(t))throw new Error("No 'src' directory found. Please provide entries manually.");const e=re(t,{extensions:[],includeDirs:!1,includeSymlinks:!1,skip:[/.*\/node_modules\/.*/,/.*\/dist\/.*/]});if(e.length===0)throw new Error("No source files found in 'src' directory. Please provide entries manually.");let r={...s.pkg};r.publishConfig&&(s.logger.info(`Using publishConfig found in package.json, to override the default key-value pairs of "${Object.keys(r.publishConfig).join(", ")}".`),s.logger.debug(r.publishConfig),r=Ve(r,s.options.declaration));const n=Oe(r,e,s);for(const i of n.warnings)he(s,i);if(s.options.entries.push(...n.entries),s.options.entries.length===0)throw new Error("No entries detected. Please provide entries manually.");s.logger.info("Automatically detected entries:",be(s.options.entries.map(i=>i.fileAlias?`${O(i.fileAlias)} => ${O(i.input.replace(`${s.options.rootDir}/`,"").replace(/\/$/,"/*"))}`:O(i.input.replace(`${s.options.rootDir}/`,"").replace(/\/$/,"/*"))).join(", ")),ve([s.options.emitESM&&"esm",s.options.emitCJS&&"cjs",s.options.declaration&&"dts"].filter(Boolean).map(i=>`[${i}]`).join(" ")))},"build:prepare")}};var Je=Object.defineProperty,Re=k((s,t)=>Je(s,"name",{value:t,configurable:!0}),"t");const Ue=Re(async(s,t)=>{if(s==="auto")s=Ge;else{if(s==="none")return{};typeof s=="string"&&(s=await t.import(s)||{})}return typeof s=="function"&&(s=s()),s},"loadPreset");var ze=Object.defineProperty,E=k((s,t)=>ze(s,"name",{value:t,configurable:!0}),"r");const Fe=E(s=>{s.addCommand({description:"Demonstrate options required",execute:E(async({logger:t,options:e})=>{let r="build";e.watch?r="watch":e.jit&&(r="jit");const n={};let i;if(e.env)for(const l of e.env)l.key==="NODE_ENV"?i=l.value:n[`process.env.${l.key}`]=JSON.stringify(l.value);i===void 0&&(e.production?i=I:e.development&&(i=V));const d=[];if(e.external)for(const l of e.external)d.push(l.split(","));const f=M(A(),e.dir??"."),y=ge(f,{debug:e.debug}),{config:o,path:u}=await Te(y,f,i,r,e.config??void 0);t.debug("Using packem config found at",u);const p=await Ue(o.preset??"auto",y);e.minify&&e.sourcemap===void 0&&(e.sourcemap=!0);try{await ke(f,r,i,t,e.debug,ye(o,p,{analyze:e.analyze,cjsInterop:e.cjsInterop,clean:e.clean,dtsOnly:e.dtsOnly,externals:d,killSignal:e.killSignal,minify:e.minify===void 0?i===I:e.minify,onSuccess:e.onSuccess,rollup:{esbuild:{target:e.target},license:{path:e.license},metafile:e.metafile,replace:{values:n},resolveExternals:e.noExternal?{builtins:!1,deps:!1,devDeps:!1,optDeps:!1,peerDeps:!1}:{}},runtime:e.runtime,sourcemap:e.metafile||e.analyze||e.sourcemap,validation:e.validation===!1?!1:{},...e.typedoc?{typedoc:{format:"html"}}:{}}),e.tsconfig??void 0)}catch(l){t.error(l),ee(1)}},"execute"),name:"build",options:[{defaultValue:".",description:"The directory to build",name:"dir",type:String},{alias:"t",description:"Environments to support. `target` in tsconfig.json is automatically added. Defaults to the current Node.js version.",name:"target"},{description:"Use a custom config file",name:"config",type:String},{description:"Path to the tsconfig.json file",name:"tsconfig",type:String},{description:"Minify the output",name:"minify",type:Boolean},{description:"Generate sourcemaps (experimental)",name:"sourcemap",type:Boolean},{conflicts:"jit",description:"Watch for changes",name:"watch",type:Boolean},{conflicts:"watch",description:"Stub the package for JIT compilation",name:"jit",type:Boolean},{description:"Compile-time environment variables (eg. --env.NODE_ENV=production)",multiple:!0,name:"env",type:E(t=>{const[e,r]=t.split("=");return{key:e,value:r}},"type")},{defaultValue:!1,description:"Generate meta file (experimental)",name:"metafile",type:Boolean},{description:"Path to the license file",name:"license",type:String},{conflicts:"watch",description:"Visualize and analyze the bundle",name:"analyze",type:Boolean},{description:"CJS interop mode, can export default and named export, (experimental).",name:"cjsInterop",type:Boolean},{conflicts:"development",description:"Run code in production environment",name:"production",type:Boolean},{conflicts:"production",description:"Run code in development environment",name:"development",type:Boolean},{description:"Do not clean the dist directory before building",name:"no-clean",type:Boolean},{description:"Only generate .d.ts files",name:"dts-only",type:Boolean},{description:"Disable the output validation",name:"no-validation",type:Boolean},{description:"Disable the cache",name:"no-cache",type:Boolean},{description:"Generate type documentation",name:"typedoc",type:Boolean},{description:"Execute command after successful build, specially useful for watch mode",name:"onSuccess",type:String},{description:'Signal to kill child process, "SIGTERM" or "SIGKILL"',name:"killSignal",type:E(t=>{if(t==="SIGTERM"||t==="SIGKILL")return t;throw new Error("Invalid kill signal. Use 'SIGTERM' or 'SIGKILL'.")},"type")},{description:"Specify an external dependency, separate by comma (eg. --external lodash,react,react-dom)",multiple:!0,name:"external",typeLabel:"string[]"},{description:"do not bundle external dependencies",name:"no-external",type:Boolean},{description:"Specify the build runtime (nodejs, browser).",name:"runtime",type:E(t=>{if(t==="node"||t==="browser")return t;throw new Error("Invalid runtime. Use 'node' or 'browser'.")},"type")}]})},"createBuildCommand");var We=Object.defineProperty,D=k((s,t)=>We(s,"name",{value:t,configurable:!0}),"f");const _e=D(s=>{s.addCommand({description:"Initialize packem configuration",execute:D(async({logger:t,options:e})=>{if(se("Welcome to packem setup"),S(x(e.dir,"packem.config.mjs"))){t.info("Packem project already initialized, you can use `packem build` to build your project");return}const r=M(A(),e.dir??"."),n=x(r,"package.json");if(!S(n))throw new Error("No package.json found in the directory");const i=$e(n),d=[];i.dependencies&&d.push(...Object.keys(i.dependencies)),i.devDependencies&&d.push(...Object.keys(i.devDependencies));const f=!!(i.devDependencies?.typescript??i.dependencies?.typescript),y=[];if(e.typescript===void 0&&!f?(e.typescript=await w({message:"Do you want to install TypeScript?"}),e.typescript&&y.push("typescript@latest")):G.message(`TypeScript version ${i.devDependencies?.typescript??i.dependencies?.typescript} is already installed`),!S(x(r,"tsconfig.json"))){const c=await w({message:"Do you want to use generate a tsconfig.json?"}),a=await w({message:"Do you want to run your code in the DOM?"});if(c){const g=K();g.start("Generating tsconfig.json"),le(x(r,"tsconfig.json"),{compilerOptions:{esModuleInterop:!0,skipLibCheck:!0,target:"es2022",allowJs:!0,resolveJsonModule:!0,moduleDetection:"force",isolatedModules:!0,verbatimModuleSyntax:!0,strict:!0,noUncheckedIndexedAccess:!0,noImplicitOverride:!0,module:"NodeNext",outDir:"dist",sourceMap:!0,declaration:!0,lib:a?["es2022","dom","dom.iterable"]:["es2022"]}}),g.stop("")}}if(e.runtime===void 0&&(e.runtime=await $({message:"Pick a build runtime",options:[{label:"Node",value:"node"},{label:"Browser",value:"browser"}]})),d.includes("esbuild")?e.transformer="esbuild":d.includes("@swc/core")?e.transformer="swc":d.includes("sucrase")&&(e.transformer="sucrase"),e.transformer===void 0?(e.transformer=await $({message:"Pick a transformer",options:[{label:"esbuild",value:"esbuild"},{label:"swc",value:"swc"},{label:"Sucrase",value:"sucrase"},{label:"OXC",value:"oxc"}]}),e.transformer&&e.transformer!=="oxc"&&!d.includes(e.transformer)&&await w({message:`Do you want to install ${e.transformer}?`})&&y.push(e.transformer==="swc"?"@swc/core":e.transformer)):G.message(`Transformer ${e.transformer} is already installed.`),e.isolatedDeclarationTransformer===void 0&&(e.isolatedDeclarationTransformer=await w({message:"Do you want to use an isolated declaration types?",initialValue:!1})),e.isolatedDeclarationTransformer===void 0&&(e.isolatedDeclarationTransformer=await $({message:"Pick a isolated declaration transformer",options:[{label:"Typescript",value:"typescript"},{label:"swc",value:"swc"},{label:"OXC",value:"oxc"},{label:"None",value:void 0}]}),e.isolatedDeclarationTransformer!==void 0)){let c;switch(e.isolatedDeclarationTransformer){case"oxc":{c="oxc-transform";break}case"swc":{c="@swc/core";break}case"typescript":{c="typescript";break}default:te("Invalid isolated declaration transformer")}c!==void 0&&!d.includes(c)&&await w({message:`Do you want to install ${c}?`})&&y.push(c)}e.css===void 0&&(e.css=await w({message:"Do you want to use css in your project?",initialValue:!1}));const o=[];if(e.css){const c=await $({message:"Pick a css loader",options:[{label:"PostCSS",value:"postcss"},{hint:"experimental",label:"Lightning CSS",value:"lightningcss"}]});o.push(c);let a=await F({message:"Pick your loaders",options:[{label:"Sass",value:"sass"},{label:"Stylus",value:"stylus"},{label:"Less",value:"less"}],required:!1});if(a.includes("sass")){const g=await $({message:"Pick a sass loader",options:[{label:"Sass embedded",value:"sass-embedded",hint:"recommended"},{label:"Sass",value:"sass"},{label:"Node Sass",value:"node-sass",hint:"legacy"}]});g!=="sass"&&(a=a.filter(m=>m!=="sass"),a.push(g))}if(o.push(...a),await w({message:`Do you want to install "${o.join('", "')}"?`}))for(const g of o)y.push(...X[g]);o.push("sourceMap")}e.cssMinifier===void 0&&(e.cssMinifier=await w({message:"Do you want to minify your css?",initialValue:!1}));let u;e.cssMinifier&&(u=await $({message:"Pick a css minifier",options:[{label:"CSSNano",value:"cssnano"},{label:"Lightning CSS",value:"lightningcss"}]}),o.includes("lightningcss")||await w({message:`Do you want to install "${u}"?`})&&y.push(u));let p="",l="";if(e.isolatedDeclarationTransformer&&(l+=`,
28
+ CSS loaders added!`)}await re(d,o.toString(),{overwrite:!0})},"execute"),name:"add",options:[{defaultValue:".",description:"The directory to build",name:"dir",type:String},{description:"Use a custom config file",name:"config",type:String}]})},"createAddCommand");var Te=Object.defineProperty,Me=k((s,t)=>Te(s,"name",{value:t,configurable:!0}),"e$1");const Be=Me(async(s,t,e,r,n)=>{const i=await X(t,n);let d=await s.import(i,{default:!0,try:!0})||{};return typeof d=="function"&&(d=await d(e,r)),{config:d,path:i}},"loadPackemConfig");var Le=Object.defineProperty,M=k((s,t)=>Le(s,"name",{value:t,configurable:!0}),"E$1");const Oe=M((s,t)=>s.key==="exports"&&s.subKey===I?I:s.key==="exports"&&s.subKey===q?q:t,"getEnvironment"),P=M((s,t,e,r,n,i,d)=>{const f=Oe(n,i.environment);let y=i.options.runtime;for(const p of me)if(n.file.includes(`.${p}.`)||n.subKey===p){y=p;break}let o=s.find(p=>p.input===t&&p.environment===f&&p.runtime===y);o===void 0?o=s[s.push({environment:f,exportKey:new Set([n.exportKey].filter(Boolean)),input:t,runtime:y})-1]:o.exportKey&&n.exportKey&&o.exportKey.add(n.exportKey),d&&(o.isGlob=!0),e&&(o.outDir=r),n.isExecutable?(o.executable=!0,o.declaration=!1,n.type==="cjs"?o.cjs=!0:n.type==="esm"&&(o.esm=!0)):(/\.d\.[mc]?ts$/.test(n.file)&&i.options.declaration!==!1&&(o.declaration=i.options.declaration),n.type==="cjs"?o.cjs=!0:n.type==="esm"&&(o.esm=!0));const u=n.file.replace(W(n.file),"").replace(new RegExp(`^./${i.options.outDir.replace(/^\.\//,"")}/`),"");V.has(n.subKey)&&!t.includes(u)&&(o.fileAlias=u)},"createOrUpdateEntry");let U=!1;const z=M(s=>{if(s.pkg?.dependencies?.typescript===void 0&&s.pkg?.devDependencies?.typescript===void 0)throw new Error("You tried to use a `.ts`, `.cts` or `.mts` file but `typescript` was not found in your package.json.")},"validateIfTypescriptIsInstalled"),Ne=M((s,t,e)=>{const r=(e.options.outputExtensionMap?.cjs??"cjs").replaceAll(".",String.raw`\.`),n=(e.options.outputExtensionMap?.esm??"mjs").replaceAll(".",String.raw`\.`),i=[];t.sort((o,u)=>o.split("/").length-u.split("/").length);const d=s.type==="module"?"esm":"cjs";d==="esm"&&(e.options.emitESM=!0),d==="cjs"&&(e.options.emitCJS=!0);const f=he(s.exports,d,e.options.declaration,[],e.options.ignoreExportKeys).filter(o=>!o.ignored);if(s.bin){const o=(typeof s.bin=="string"?[s.bin]:Object.values(s.bin)).filter(Boolean);for(const u of o){const p=G(u);if(p&&p!==d)throw new Error(`Exported file "${u}" has an extension that does not match the package.json type "${s.type??"commonjs"}".`);f.push({file:u,isExecutable:!0,key:"bin",type:p??d})}}s.main&&f.push({file:s.main,key:"main",type:G(s.main)??d}),s.module&&f.push({file:s.module,key:"module",type:"esm"}),(s.types||s.typings)&&(z(e),e.options.declaration===void 0&&(e.options.declaration="compatible"),f.push({file:s.types??s.typings,key:"types"}));const y=[];for(const o of f){const u=W(o.file);if(u!==""&&!fe.includes(u))continue;e.options.declaration===void 0&&(o.key==="types"||o.subKey==="types")&&(e.options.declaration=o.file.includes(".d.ts")?"compatible":!0),e.options.emitCJS===void 0&&o.type==="cjs"&&(e.options.emitCJS=!0),e.options.emitESM===void 0&&o.type==="esm"&&(e.options.emitESM=!0);const p=o.file.replace(new RegExp(String.raw`(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+|${[`\\.${r}`,`\\.${n}`].join("|")})$`),""),l=p.endsWith("/");if(l&&["./","/"].includes(p))continue;const b=p.replace(new RegExp(`(./)?${e.options.outDir}`),e.options.sourceDir).replace("./",""),v="(?<=/|$)",c=l?"":String.raw`(\.d\.[cm]?ts|(\.[cm]?[tj]sx?)|${[`\\.${r}`,`\\.${n}`].join("|")})$`;if(o.file.includes("/*")&&o.key==="exports"){U||(e.logger.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),U=!0);const h=[],j=new RegExp(v+b.replace("*","(.*)")+c),L=b.replace(/^(.+?)\.[^.]*$/,"$1"),Y=new RegExp(v+L.replace("*","(.*)")+c);for(const C of t)(j.test(C)||V.has(o.subKey)&&Y.test(C))&&h.push(C);if(h.length===0){i.push(`Could not find entrypoint for \`${o.file}\``);continue}for(const C of h)P(y,C,l,p,o,e,!0);continue}const a=new RegExp(v+b+c);let g=t.find(h=>a.test(h));if(V.has(o.subKey)&&g===void 0){const h=b.replace(/^(.+?)\.[^.]*$/,"$1"),j=new RegExp(v+h+c);g=t.find(L=>j.test(L))}if(g===void 0){S(T(e.options.rootDir,o.file))||i.push(`Could not find entrypoint for \`${o.file}\``);continue}S(g)&&/\.[cm]?tsx?$/.test(g)&&z(e);const m=de(g.replace(ye,""));S(`${m}.cts`)&&S(`${m}.mts`)?(P(y,`${m}.cts`,l,p,{...o,type:"cjs"},e,!1),P(y,`${m}.mts`,l,p,{...o,type:"esm"},e,!1)):P(y,g,l,p,o,e,!1)}return e.options.emitESM&&!e.options.emitCJS&&e.options.declaration===void 0&&(e.options.declaration="node16"),{entries:y,warnings:i}},"inferEntries");var Ke=Object.defineProperty,qe=k((s,t)=>Ke(s,"name",{value:t,configurable:!0}),"o");const Ve=qe((s,t)=>{const{publishConfig:e}=s;return e&&(e.bin&&(typeof e.bin=="object"||typeof e.bin=="string")&&(s.bin=e.bin),e.type&&typeof e.type=="string"&&e.type!==""&&(s.type=e.type),e.main&&typeof e.main=="string"&&e.main!==""&&(s.main=e.main),e.module&&typeof e.module=="string"&&e.module!==""&&(s.module=e.module),t===void 0&&e.types&&typeof e.types=="string"&&e.types!==""?s.types=e.types:t===void 0&&e.typings&&typeof e.typings=="string"&&e.typings!==""&&(s.typings=e.typings),e.exports&&typeof e.exports=="object"&&(s.exports=e.exports)),s},"overwriteWithPublishConfig");var Ae=Object.defineProperty,Re=k((s,t)=>Ae(s,"name",{value:t,configurable:!0}),"t$1");const Ge={hooks:{"build:prepare":Re(function(s){if(s.options.entries.length>0)return;const t=x(s.options.rootDir,s.options.sourceDir);if(!S(t))throw new Error("No 'src' directory found. Please provide entries manually.");const e=le(t,{extensions:[],includeDirs:!1,includeSymlinks:!1,skip:[/.*\/node_modules\/.*/,/.*\/dist\/.*/]});if(e.length===0)throw new Error("No source files found in 'src' directory. Please provide entries manually.");let r={...s.pkg};r.publishConfig&&(s.logger.info(`Using publishConfig found in package.json, to override the default key-value pairs of "${Object.keys(r.publishConfig).join(", ")}".`),s.logger.debug(r.publishConfig),r=Ve(r,s.options.declaration));const n=Ne(r,e,s);for(const i of n.warnings)ke(s,i);if(s.options.entries.push(...n.entries),s.options.entries.length===0)throw new Error("No entries detected. Please provide entries manually.");s.logger.info("Automatically detected entries:",ve(s.options.entries.map(i=>i.fileAlias?`${O(i.fileAlias)} => ${O(i.input.replace(`${s.options.rootDir}/`,"").replace(/\/$/,"/*"))}`:O(i.input.replace(`${s.options.rootDir}/`,"").replace(/\/$/,"/*"))).join(", ")),we([s.options.emitESM&&"esm",s.options.emitCJS&&"cjs",s.options.declaration&&"dts"].filter(Boolean).map(i=>`[${i}]`).join(" ")))},"build:prepare")}};var Je=Object.defineProperty,Ue=k((s,t)=>Je(s,"name",{value:t,configurable:!0}),"t");const ze=Ue(async(s,t)=>{if(s==="auto")s=Ge;else{if(s==="none")return{};typeof s=="string"&&(s=await t.import(s)||{})}return typeof s=="function"&&(s=s()),s},"loadPreset");var _e=Object.defineProperty,E=k((s,t)=>_e(s,"name",{value:t,configurable:!0}),"r");const Fe=E(s=>{s.addCommand({description:"Demonstrate options required",execute:E(async({logger:t,options:e})=>{let r="build";e.watch?r="watch":e.jit&&(r="jit");const n={};let i;if(e.env)for(const l of e.env)l.key==="NODE_ENV"?i=l.value:n[`process.env.${l.key}`]=JSON.stringify(l.value);i===void 0&&(e.production?i=I:e.development&&(i=q));const d=[];if(e.external)for(const l of e.external)d.push(l.split(","));const f=T(A(),e.dir??"."),y=be(f,{debug:e.debug}),{config:o,path:u}=await Be(y,f,i,r,e.config??void 0);t.debug("Using packem config found at",u);const p=await ze(o.preset??"auto",y);e.minify&&e.sourcemap===void 0&&(e.sourcemap=!0);try{await $e(f,r,i,t,e.debug,ge(o,p,{analyze:e.analyze,cjsInterop:e.cjsInterop,clean:e.clean,dtsOnly:e.dtsOnly,externals:d,killSignal:e.killSignal,minify:e.minify===void 0?i===I:e.minify,onSuccess:e.onSuccess,rollup:{esbuild:{target:e.target},license:{path:e.license},metafile:e.metafile,replace:{values:n},resolveExternals:e.noExternal?{builtins:!1,deps:!1,devDeps:!1,optDeps:!1,peerDeps:!1}:{}},runtime:e.runtime,sourcemap:e.metafile||e.analyze||e.sourcemap,validation:e.validation===!1?!1:{},...e.typedoc?{typedoc:{format:"html"}}:{}}),e.tsconfig??void 0)}catch(l){t.error(l),se(1)}},"execute"),name:"build",options:[{defaultValue:".",description:"The directory to build",name:"dir",type:String},{alias:"t",description:"Environments to support. `target` in tsconfig.json is automatically added. Defaults to the current Node.js version.",name:"target"},{description:"Use a custom config file",name:"config",type:String},{description:"Path to the tsconfig.json file",name:"tsconfig",type:String},{description:"Minify the output",name:"minify",type:Boolean},{description:"Generate sourcemaps (experimental)",name:"sourcemap",type:Boolean},{conflicts:"jit",description:"Watch for changes",name:"watch",type:Boolean},{conflicts:"watch",description:"Stub the package for JIT compilation",name:"jit",type:Boolean},{description:"Compile-time environment variables (eg. --env.NODE_ENV=production)",multiple:!0,name:"env",type:E(t=>{const[e,r]=t.split("=");return{key:e,value:r}},"type")},{defaultValue:!1,description:"Generate meta file (experimental)",name:"metafile",type:Boolean},{description:"Path to the license file",name:"license",type:String},{conflicts:"watch",description:"Visualize and analyze the bundle",name:"analyze",type:Boolean},{description:"CJS interop mode, can export default and named export, (experimental).",name:"cjsInterop",type:Boolean},{conflicts:"development",description:"Run code in production environment",name:"production",type:Boolean},{conflicts:"production",description:"Run code in development environment",name:"development",type:Boolean},{description:"Do not clean the dist directory before building",name:"no-clean",type:Boolean},{description:"Only generate .d.ts files",name:"dts-only",type:Boolean},{description:"Disable the output validation",name:"no-validation",type:Boolean},{description:"Disable the cache",name:"no-cache",type:Boolean},{description:"Generate type documentation",name:"typedoc",type:Boolean},{description:"Execute command after successful build, specially useful for watch mode",name:"onSuccess",type:String},{description:'Signal to kill child process, "SIGTERM" or "SIGKILL"',name:"killSignal",type:E(t=>{if(t==="SIGTERM"||t==="SIGKILL")return t;throw new Error("Invalid kill signal. Use 'SIGTERM' or 'SIGKILL'.")},"type")},{description:"Specify an external dependency, separate by comma (eg. --external lodash,react,react-dom)",multiple:!0,name:"external",typeLabel:"string[]"},{description:"do not bundle external dependencies",name:"no-external",type:Boolean},{description:"Specify the build runtime (nodejs, browser).",name:"runtime",type:E(t=>{if(t==="node"||t==="browser")return t;throw new Error("Invalid runtime. Use 'node' or 'browser'.")},"type")}]})},"createBuildCommand");var We=Object.defineProperty,D=k((s,t)=>We(s,"name",{value:t,configurable:!0}),"f");const Xe=D(s=>{s.addCommand({description:"Initialize packem configuration",execute:D(async({logger:t,options:e})=>{if(te("Welcome to packem setup"),S(x(e.dir,"packem.config.mjs"))){t.info("Packem project already initialized, you can use `packem build` to build your project");return}const r=T(A(),e.dir??"."),n=x(r,"package.json");if(!S(n))throw new Error("No package.json found in the directory");const i=Se(n),d=[];i.dependencies&&d.push(...Object.keys(i.dependencies)),i.devDependencies&&d.push(...Object.keys(i.devDependencies));const f=!!(i.devDependencies?.typescript??i.dependencies?.typescript),y=[];if(e.typescript===void 0&&!f?(e.typescript=await w({message:"Do you want to install TypeScript?"}),e.typescript&&y.push("typescript@latest")):R.message(`TypeScript version ${i.devDependencies?.typescript??i.dependencies?.typescript} is already installed`),!S(x(r,"tsconfig.json"))){const c=await w({message:"Do you want to use generate a tsconfig.json?"}),a=await w({message:"Do you want to run your code in the DOM?"});if(c){const g=K();g.start("Generating tsconfig.json"),ce(x(r,"tsconfig.json"),{compilerOptions:{esModuleInterop:!0,skipLibCheck:!0,target:"es2022",allowJs:!0,resolveJsonModule:!0,moduleDetection:"force",isolatedModules:!0,verbatimModuleSyntax:!0,strict:!0,noUncheckedIndexedAccess:!0,noImplicitOverride:!0,module:"NodeNext",outDir:"dist",sourceMap:!0,declaration:!0,lib:a?["es2022","dom","dom.iterable"]:["es2022"]}}),g.stop("")}}if(e.runtime===void 0&&(e.runtime=await $({message:"Pick a build runtime",options:[{label:"Node",value:"node"},{label:"Browser",value:"browser"}]})),d.includes("esbuild")?e.transformer="esbuild":d.includes("@swc/core")?e.transformer="swc":d.includes("sucrase")&&(e.transformer="sucrase"),e.transformer===void 0?(e.transformer=await $({message:"Pick a transformer",options:[{label:"esbuild",value:"esbuild"},{label:"swc",value:"swc"},{label:"Sucrase",value:"sucrase"},{label:"OXC",value:"oxc"}]}),e.transformer&&e.transformer!=="oxc"&&!d.includes(e.transformer)&&await w({message:`Do you want to install ${e.transformer}?`})&&y.push(e.transformer==="swc"?"@swc/core":e.transformer)):R.message(`Transformer ${e.transformer} is already installed.`),e.isolatedDeclarationTransformer===void 0&&(e.isolatedDeclarationTransformer=await w({message:"Do you want to use an isolated declaration types?",initialValue:!1})),e.isolatedDeclarationTransformer===void 0&&(e.isolatedDeclarationTransformer=await $({message:"Pick a isolated declaration transformer",options:[{label:"Typescript",value:"typescript"},{label:"swc",value:"swc"},{label:"OXC",value:"oxc"},{label:"None",value:void 0}]}),e.isolatedDeclarationTransformer!==void 0)){let c;switch(e.isolatedDeclarationTransformer){case"oxc":{c="oxc-transform";break}case"swc":{c="@swc/core";break}case"typescript":{c="typescript";break}default:oe("Invalid isolated declaration transformer")}c!==void 0&&!d.includes(c)&&await w({message:`Do you want to install ${c}?`})&&y.push(c)}e.css===void 0&&(e.css=await w({message:"Do you want to use css in your project?",initialValue:!1}));const o=[];if(e.css){const c=await $({message:"Pick a css loader",options:[{label:"PostCSS",value:"postcss"},{hint:"experimental",label:"Lightning CSS",value:"lightningcss"}]});o.push(c);let a=await F({message:"Pick your loaders",options:[{label:"Sass",value:"sass"},{label:"Stylus",value:"stylus"},{label:"Less",value:"less"}],required:!1});if(a.includes("sass")){const g=await $({message:"Pick a sass loader",options:[{label:"Sass embedded",value:"sass-embedded",hint:"recommended"},{label:"Sass",value:"sass"},{label:"Node Sass",value:"node-sass",hint:"legacy"}]});g!=="sass"&&(a=a.filter(m=>m!=="sass"),a.push(g))}if(o.push(...a),await w({message:`Do you want to install "${o.join('", "')}"?`}))for(const g of o)y.push(...H[g]);o.push("sourceMap")}e.cssMinifier===void 0&&(e.cssMinifier=await w({message:"Do you want to minify your css?",initialValue:!1}));let u;e.cssMinifier&&(u=await $({message:"Pick a css minifier",options:[{label:"CSSNano",value:"cssnano"},{label:"Lightning CSS",value:"lightningcss"}]}),o.includes("lightningcss")||await w({message:`Do you want to install "${u}"?`})&&y.push(u));let p="",l="";if(e.isolatedDeclarationTransformer&&(l+=`,
29
29
  isolatedDeclarationTransformer`),(e.css||e.cssMinifier)&&(l+=`,
30
30
  rollup: {
31
31
  css: {`),e.css){const c=o.map(a=>((a==="sass-embedded"||a==="node-sass")&&(a="sass"),`${a}Loader`)).join(", ");l+=`
@@ -52,4 +52,4 @@ module.exports = defineConfig({
52
52
  runtime: ${e.runtime},
53
53
  transformer${l}
54
54
  });
55
- `}const b=K(),v=f?"ts":"js";y.length>0&&(b.start("Installing packages"),await N(y,{cwd:r,dev:!0,silent:!0}),b.stop("Installed packages")),b.start(`Creating packem.config.${v}`),ce(x(r,`packem.config.${v}`),p),b.stop(`Created packem.config.${v}`),oe("Now you can run `packem build` to build your project")},"execute"),name:"init",options:[{defaultValue:".",description:"The directory to initialize",name:"dir",type:String},{description:"Choose a transformer",name:"transformer",type:D(t=>{if(typeof t=="string"&&["esbuild","sucrase","swc"].includes(t))return t;throw new Error("Invalid transformer, please choose one of 'swc', 'sucrase' or 'esbuild'")},"type")},{description:"Choose a isolated declaration transformer",name:"isolated-declaration-transformer",type:D(t=>{if(typeof t=="string"&&["none","oxc","swc","typescript"].includes(t))return t;throw new Error("Invalid isolated declaration isolated declaration, please choose one of 'none', 'oxc', 'swc' or 'typescript'")},"type")},{description:"Use CSS",name:"css",type:Boolean},{description:"Use CSS minifier",name:"css-minifier",type:Boolean},{Description:"Use TypeScript",name:"typescript",type:Boolean},{description:"Specify the build runtime (nodejs, browser).",name:"runtime",type:D(t=>{if(t==="node"||t==="browser")return t;throw new Error("Invalid runtime. Use 'node' or 'browser'.")},"type")}]})},"createInitCommand");try{require("node:module")?.enableCompileCache?.()||require("v8-compile-cache")}catch{}const B=new Q("packem",{logger:{reporters:[new Z({error:{hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0}})],scope:"packem"},packageName:Se,packageVersion:xe});_e(B);Fe(B);Pe(B);B.run({shouldExitProcess:!1});
55
+ `}const b=K(),v=f?"ts":"js";y.length>0&&(b.start("Installing packages"),await N(y,{cwd:r,dev:!0,silent:!0}),b.stop("Installed packages")),b.start(`Creating packem.config.${v}`),pe(x(r,`packem.config.${v}`),p),b.stop(`Created packem.config.${v}`),ie("Now you can run `packem build` to build your project")},"execute"),name:"init",options:[{defaultValue:".",description:"The directory to initialize",name:"dir",type:String},{description:"Choose a transformer",name:"transformer",type:D(t=>{if(typeof t=="string"&&["esbuild","sucrase","swc"].includes(t))return t;throw new Error("Invalid transformer, please choose one of 'swc', 'sucrase' or 'esbuild'")},"type")},{description:"Choose a isolated declaration transformer",name:"isolated-declaration-transformer",type:D(t=>{if(typeof t=="string"&&["none","oxc","swc","typescript"].includes(t))return t;throw new Error("Invalid isolated declaration isolated declaration, please choose one of 'none', 'oxc', 'swc' or 'typescript'")},"type")},{description:"Use CSS",name:"css",type:Boolean},{description:"Use CSS minifier",name:"css-minifier",type:Boolean},{Description:"Use TypeScript",name:"typescript",type:Boolean},{description:"Specify the build runtime (nodejs, browser).",name:"runtime",type:D(t=>{if(t==="node"||t==="browser")return t;throw new Error("Invalid runtime. Use 'node' or 'browser'.")},"type")}]})},"createInitCommand");try{require("node:module")?.enableCompileCache?.()||require("v8-compile-cache")}catch{}const B=new Z("packem",{logger:{reporters:[new ee({error:{hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0}})],scope:"packem"},packageName:xe,packageVersion:je});Xe(B);Fe(B);Ie(B);B.run({shouldExitProcess:!1});
@@ -1,5 +1,6 @@
1
- import { B as BuildConfig, c as BuildConfigFunction, d as BuildPreset } from '../packem_shared/types-5psa8MJc.js';
2
- export { d as BuildHooks } from '../packem_shared/index-zrs6Po_w.js';
1
+ import { B as BuildConfig, c as BuildConfigFunction, d as BuildPreset } from '../packem_shared/types-XVKzG-HR.js';
2
+ export { d as BuildHooks } from '../packem_shared/index-CzQ8bh8T.js';
3
+ import '@arethetypeswrong/core';
3
4
  import '@visulima/rollup-plugin-css';
4
5
  import 'jiti';
5
6
  import 'typedoc';
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { ConstructorOptions } from '@visulima/pail';
2
- import { B as BuildConfig } from './packem_shared/types-5psa8MJc.js';
3
- export { a as BuildEntry, b as BuildOptions, R as RollupBuildOptions } from './packem_shared/types-5psa8MJc.js';
4
- import { E as Environment, M as Mode } from './packem_shared/index-zrs6Po_w.js';
5
- export { B as BuildContext, b as BuildContextBuildAssetAndChunk, c as BuildContextBuildEntry, d as BuildHooks, I as IsolatedDeclarationsTransformer, R as Runtime, T as TransformerFn, a as TransformerName } from './packem_shared/index-zrs6Po_w.js';
2
+ import { B as BuildConfig } from './packem_shared/types-XVKzG-HR.js';
3
+ export { a as BuildEntry, b as BuildOptions, R as RollupBuildOptions } from './packem_shared/types-XVKzG-HR.js';
4
+ import { E as Environment, M as Mode } from './packem_shared/index-CzQ8bh8T.js';
5
+ export { B as BuildContext, b as BuildContextBuildAssetAndChunk, c as BuildContextBuildEntry, d as BuildHooks, I as IsolatedDeclarationsTransformer, R as Runtime, T as TransformerFn, a as TransformerName } from './packem_shared/index-CzQ8bh8T.js';
6
+ import '@arethetypeswrong/core';
6
7
  import '@visulima/rollup-plugin-css';
7
8
  import 'jiti';
8
9
  import 'typedoc';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var c=Object.defineProperty;var o=(e,r)=>c(e,"name",{value:r,configurable:!0});import{createPail as s}from"@visulima/pail";import{SimpleReporter as u}from"@visulima/pail/reporter";import{b as g}from"./packem_shared/index-CFFENGTN.js";var f=Object.defineProperty,l=o((e,r)=>f(e,"name",{value:r,configurable:!0}),"r");const C=l(async(e,r={})=>{const{debug:t,environment:i,logger:a,mode:n,tsconfigPath:m,...d}={debug:!1,environment:"production",logger:{},mode:"build",tsconfigPath:void 0,...r},p=s({reporters:[new u({error:{hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0}})],scope:"packem",...a});await g(e,n,i,p,t,d,m)},"packem");export{C as packem};
1
+ var c=Object.defineProperty;var o=(e,r)=>c(e,"name",{value:r,configurable:!0});import{createPail as s}from"@visulima/pail";import{SimpleReporter as u}from"@visulima/pail/reporter";import{x as g}from"./packem_shared/index-C56sx504.js";var f=Object.defineProperty,l=o((e,r)=>f(e,"name",{value:r,configurable:!0}),"r");const C=l(async(e,r={})=>{const{debug:t,environment:i,logger:a,mode:n,tsconfigPath:m,...d}={debug:!1,environment:"production",logger:{},mode:"build",tsconfigPath:void 0,...r},p=s({reporters:[new u({error:{hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0}})],scope:"packem",...a});await g(e,n,i,p,t,d,m)},"packem");export{C as packem};
@@ -1 +1 @@
1
- import{d as a}from"./isolatedDeclarationsOxcTransformer-WbfE6cGu-NeZOx2Y7.js";import{z as s}from"./oxcResolvePlugin-BJpi-eSG-BsYx9cDO.js";import{n as x}from"./oxcTransformPlugin-DfVQouIB-Cpfv95eA.js";export{a as isolatedDeclarationsOxcTransformer,s as oxcResolvePlugin,x as oxcTransformPlugin};
1
+ import{d as a}from"./isolatedDeclarationsOxcTransformer-WbfE6cGu-NeZOx2Y7.js";import{z as s}from"./oxcResolvePlugin-BJpi-eSG-Dnnq2zke.js";import{n as x}from"./oxcTransformPlugin-DfVQouIB-Cpfv95eA.js";export{a as isolatedDeclarationsOxcTransformer,s as oxcResolvePlugin,x as oxcTransformPlugin};
@@ -0,0 +1 @@
1
+ var l=Object.defineProperty;var o=(e,r)=>l(e,"name",{value:r,configurable:!0});import{createFilter as f}from"@rollup/pluginutils";import{f as p}from"./index-CUp9WuCG.js";const m=globalThis.process.getBuiltinModule("module").createRequire(import.meta.url),{transform:d}=m("sucrase");var b=Object.defineProperty,v=o((e,r)=>b(e,"name",{value:r,configurable:!0}),"n"),g=Object.defineProperty,P=v((e,r)=>g(e,"name",{value:r,configurable:!0}),"a"),j=Object.defineProperty,y=P((e,r)=>j(e,"name",{value:r,configurable:!0}),"n");const t=y(({exclude:e,include:r,...n})=>{const c=f(r,e??p);return{name:"packem:sucrase",async transform(s,a){if(!c(a))return;const{code:u,sourceMap:i}=d(s,{...n,filePath:a,sourceMapOptions:{compiledFilename:a}});return{code:u,map:i}}}},"sucraseTransformPlugin");t.NAME="sucrase";const h=t;export{h as sucrasePlugin};
@@ -1 +1 @@
1
- import{b as r}from"./browserslistToEsbuild-C0IWmbNe-C6xPL1oW.js";import{z as e}from"./esbuildPlugin-CXr7ud3R-CwR2FCHj.js";export{r as browserslistToEsbuild,e as esbuildPlugin};
1
+ import{b as r}from"./browserslistToEsbuild-C0IWmbNe-C6xPL1oW.js";import{z as e}from"./esbuildPlugin-BrFhdKJk-ByenQxgl.js";export{r as browserslistToEsbuild,e as esbuildPlugin};
@@ -1 +1 @@
1
- import{v as r}from"./isolatedDeclarationsTypescriptTransformer-DkuEkofo-Cwe3ODMG.js";import{B as o,B as p,N as t,D as a,i as c}from"./resolveTypescriptMjsCtsPlugin-DcZrZTmM-BEkYWTsH.js";export{r as isolatedDeclarationsTypescriptTransformer,o as patchTypescriptTypes,p as patchTypescriptTypesPlugin,t as resolveTsconfigPathsPlugin,a as resolveTsconfigRootDirectoriesPlugin,c as resolveTypescriptMjsCtsPlugin};
1
+ import{v as r}from"./isolatedDeclarationsTypescriptTransformer-DkuEkofo-OpINP11F.js";import{B as o,B as p,N as t,D as a,i as c}from"./resolveTypescriptMjsCtsPlugin-DcZrZTmM-CKlu5gDZ.js";export{r as isolatedDeclarationsTypescriptTransformer,o as patchTypescriptTypes,p as patchTypescriptTypesPlugin,t as resolveTsconfigPathsPlugin,a as resolveTsconfigRootDirectoriesPlugin,c as resolveTypescriptMjsCtsPlugin};
@@ -0,0 +1,3 @@
1
+ var k=Object.defineProperty;var v=(e,r)=>k(e,"name",{value:r,configurable:!0});import{createFilter as M}from"@rollup/pluginutils";import{a as P}from"./index-CUp9WuCG.js";import{extname as A,join as $}from"@visulima/path";import{findCacheDirSync as R}from"@visulima/find-cache-dir";import{readFileSync as S}from"@visulima/fs";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
2
+ const require = __cjs_mod__.createRequire(import.meta.url);
3
+ const w=globalThis.process.getBuiltinModule("module").createRequire(import.meta.url),{transform:_,formatMessages:E,build:q}=w("esbuild"),h=w("rs-module-lexer"),W={...h,default:h};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"),T=Object.defineProperty,B=f((e,r)=>T(e,"name",{value:r,configurable:!0}),"n$1");const j=B(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"),G=D(({sourceMap:e=!0,...r})=>async function(s,a,i){if(r.minify||r.minifyWhitespace||r.minifyIdentifiers||r.minifySyntax){const t=N(i.format),c=await _(s,{format:t,loader:"js",sourcemap:e,...r});if(await j(this,c.warnings),c.code)return{code:c.code,map:c.map||void 0}}},"getRenderChunk");var H=Object.defineProperty,z=f((e,r)=>H(e,"name",{value:r,configurable:!0}),"n");const y=z(e=>e.replaceAll("\\","/"),"slash"),{parseAsync:U}=W,J=z(async e=>{const r=R("@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 q({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(a){a.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 a.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}}}}),a.onLoad({filter:/.*/,namespace:"optimize-deps"},async i=>{const{absolute:t,resolveDir:c}=i.pluginData,u=S(t),{output:g}=await U({input:[{code:u,filename:t}]});return{contents:(g[0]?.exports??[]).length>0?`export * from '${y(t)}'`:`module.exports = require('${y(t)}')`,resolveDir:c}})}},...e.esbuildOptions?.plugins??[]]});const s=new Map;for(const a of e.include)s.set(a,{file:$(r,`${a}.js`)});return{cacheDir:r,optimized:s}},"optimizeDeps");var K=Object.defineProperty,Q=f((e,r)=>K(e,"name",{value:r,configurable:!0}),"g");const V=Q(({exclude:e,include:r,loaders:s,logger:a,optimizeDeps:i,sourceMap:t,...c})=>{const u=P;if(s!==void 0)for(let[o,n]of Object.entries(s)){const p=o.startsWith(".")?o:`.${o}`;typeof n=="string"?u[p]=n:n||delete u[p]}const g=Object.keys(u),x=new RegExp(`\\.(${g.map(o=>o.slice(1)).join("|")})$`),O=M(r??x,e);let l,b=process.cwd();return{async buildStart(){!i||l||(l=await J({cwd:b,sourceMap:t??!1,...i}),a.debug("optimized %O",l.optimized))},name:"packem:esbuild",options({context:o}){o&&(b=o)},renderChunk:G({...c,sourceMap:t}),async resolveId(o){if(l?.optimized.has(o)){const n=l.optimized.get(o);if(n)return a.debug("resolved %s to %s",o,n.file),n.file}},async transform(o,n){if(!O(n)||l?.optimized.has(n))return;const p=A(n),d=u[p];if(a.debug("transforming %s with %s loader",n,d),!d)return;const m=await _(o,{format:["base64","binary","dataurl","text","json"].includes(d)?"esm":void 0,loader:d,sourcefile:n.replace(/\.[cm]ts/,".ts"),sourcemap:t,...c});if(await j(this,m.warnings),m.code)return{code:m.code,map:m.map||void 0}}}},"esbuildTransformer");V.NAME="esbuild";export{V as z};