@visulima/packem 2.0.0-alpha.84 → 2.0.0-alpha.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/builder/typedoc/index.d.ts +1 -1
- package/dist/builder/typedoc/index.js +3 -3
- package/dist/cli/index.js +36 -36
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/preset/preact.d.ts +1 -1
- package/dist/config/preset/preact.js +2 -2
- package/dist/config/preset/react.d.ts +1 -1
- package/dist/config/preset/react.js +1 -1
- package/dist/config/preset/solid.d.ts +1 -1
- package/dist/config/preset/solid.js +1 -1
- package/dist/config/preset/svelte.d.ts +1 -1
- package/dist/config/preset/svelte.js +1 -1
- package/dist/config/preset/vue.d.ts +1 -1
- package/dist/config/preset/vue.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +36 -36
- package/dist/packem_shared/create-or-update-key-storage-CRDW-Kwa.js +28 -0
- package/dist/packem_shared/default-nqaAQAPN.js +1 -0
- package/dist/packem_shared/index-BSqT47P3.js +244 -0
- package/dist/packem_shared/oxcTransformPlugin-Dwvbw2jE-BSBF_-9X.js +177 -0
- package/dist/packem_shared/{types.d-DOt53hsx.d.ts → types.d-ICL9GlqC.d.ts} +8 -1
- package/dist/packem_shared/utils-Bsoe7qJG.js +1 -0
- package/dist/rollup/plugins/oxc/oxc-transformer.js +1 -1
- package/package.json +5 -5
- package/dist/packem_shared/create-or-update-key-storage-Cp_qI2Lt.js +0 -28
- package/dist/packem_shared/default-Dbrx9zI9.js +0 -1
- package/dist/packem_shared/index-C1JIQmoZ.js +0 -244
- package/dist/packem_shared/oxcTransformPlugin-Dwvbw2jE-CIiF8y3S.js +0 -185
- package/dist/packem_shared/utils-nmTpa3um.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
## @visulima/packem [2.0.0-alpha.85](https://github.com/visulima/packem/compare/@visulima/packem@2.0.0-alpha.84...@visulima/packem@2.0.0-alpha.85) (2026-06-04)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **packem:** browser-runtime targets, shared esbuild config isolation, entry-collection perf + bench ([2e2d2da](https://github.com/visulima/packem/commit/2e2d2da705e270ec5a94fc7f26d8a1268fe6cc39))
|
|
6
|
+
* **packem:** default esbuild keepNames to false ([#207](https://github.com/visulima/packem/issues/207)) ([ceab5c5](https://github.com/visulima/packem/commit/ceab5c521a18eed10f9137d59826f9eb6e6f178e))
|
|
7
|
+
|
|
8
|
+
### Performance Improvements
|
|
9
|
+
|
|
10
|
+
* **packem:** prune orphan shared declaration chunk variants in dts output ([ef823a9](https://github.com/visulima/packem/commit/ef823a9f4ef78867afc6706141a12a2bbf637474))
|
|
11
|
+
|
|
12
|
+
### Styles
|
|
13
|
+
|
|
14
|
+
* clear eslint debt from the audit/types passes ([fd68951](https://github.com/visulima/packem/commit/fd68951681817078ae579dcad10963b1a07c1d27))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Dependencies
|
|
18
|
+
|
|
19
|
+
* **@visulima/packem-share:** upgraded to 1.0.0-alpha.49
|
|
20
|
+
* **@visulima/rollup-plugin-css:** upgraded to 1.0.0-alpha.52
|
|
21
|
+
* **@visulima/rollup-plugin-dts:** upgraded to 1.0.0-alpha.33
|
|
22
|
+
* **@visulima/packem-rollup:** upgraded to 1.0.0-alpha.72
|
|
23
|
+
|
|
1
24
|
## @visulima/packem [2.0.0-alpha.84](https://github.com/visulima/packem/compare/@visulima/packem@2.0.0-alpha.83...@visulima/packem@2.0.0-alpha.84) (2026-06-03)
|
|
2
25
|
|
|
3
26
|
### Bug Fixes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuildContext } from '@visulima/packem-share/types';
|
|
2
|
-
import { I as InternalBuildOptions } from "../../packem_shared/types.d-
|
|
2
|
+
import { I as InternalBuildOptions } from "../../packem_shared/types.d-ICL9GlqC.js";
|
|
3
3
|
import '@arethetypeswrong/core';
|
|
4
4
|
import '@visulima/packem-plugins';
|
|
5
5
|
import '@visulima/packem-plugins/oxc';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
${
|
|
3
|
-
`),n.info({message:`Using ${
|
|
1
|
+
import{P as h,T as w,f as k,q as $}from"../../packem_shared/create-or-update-key-storage-CRDW-Kwa.js";import{w as m}from"../../packem_shared/utils-Bsoe7qJG.js";import{readdirSync as E}from"node:fs";import{replaceContentWithinMarker as j}from"@visulima/packem-share";import{Application as A}from"typedoc";const P=(e,o,t,r,n)=>{const s=E(e,{withFileTypes:!0}).filter(a=>a.isFile());let i="";for(const a of s)a.name==="README.md"&&o>1||(i+=h(m(e,a.name)).replaceAll(`<!-- ${t}`,`<!-- _REPLACE_${t}`).replaceAll("<!-- ${marker}",`<!-- _REPLACE_\\${t}`));if(i==="")return;const c=h(r),p=j(c,t,`
|
|
2
|
+
${i}`);if(!p){n.error({message:`Could not find the typedoc marker: <!-- ${t} --><!-- /${t} --> in ${r}`,prefix:"typedoc"});return}c!==p&&w(r,p.replaceAll(`<!-- _REPLACE_${t}`,`<!-- ${t}`).replaceAll(`<!-- _REPLACE_\\${t}`,"<!-- ${marker}"),{overwrite:!0})},v=(e,o,t,r)=>{if(e==="inline"&&t===void 0)throw new Error("The `readmePath` option is required when using the `inline` format.");if(e!=="inline"&&typeof t=="string"&&r.warn({message:"The `readmePath` option is only used when the `inline` format is used.",prefix:"typedoc"}),e==="json"&&!o?.endsWith(".json"))throw new Error(o===void 0?"The `jsonFileName` option is required when using the `json` format.":"The `jsonFileName` option must end with `.json`.");e!=="json"&&typeof o=="string"&&r.warn({message:"The `jsonFileName` option is only used when the `json` format is used.",prefix:"typedoc"})},C=async(e,o,t,r)=>{if(o.length===0)return;const{format:n,jsonFileName:s,marker:i,output:c,plugin:p,readmePath:a,...f}=e;v(n,s,a,r);const y=o.map(g=>g.input),u=p??[];u.push("typedoc-plugin-rename-defaults"),(n==="inline"||n==="markdown")&&u.push("typedoc-plugin-markdown");const l=await A.bootstrapWithPlugins({...f,compilerOptions:{allowJs:!0,declaration:!1,declarationMap:!1,esModuleInterop:!0,module:99,moduleResolution:100,noEmit:!0,noImplicitAny:!1,skipLibCheck:!0,sourceMap:!1,target:99,...f.compilerOptions},entryPoints:y,hideGenerator:!0,out:t,plugin:u,...n==="inline"?{hideBreadcrumbs:!0,hidePageHeader:!0,navigation:!1,outputFileStrategy:"modules",useCodeBlocks:!0}:{}},[]),d=await l.convert();if(d){if(n==="json")await l.generateJson(d,s);else if(n==="html")await l.generateDocs(d,t);else if(await l.generateOutputs(d),n==="inline"){if(i===void 0)throw new Error("The `marker` option is required when using the `inline` format.");P(t,o.length,i,a,r)}}},T=e=>e.logger,L=async(e,o,t,r)=>{if(e.options.typedoc&&e.options.typedoc.format!==void 0){const n=T(e);let s="unknown";e.pkg.dependencies?.typedoc?s=e.pkg.dependencies.typedoc:e.pkg.devDependencies?.typedoc&&(s=e.pkg.devDependencies.typedoc),o&&k("typedoc",o,n,!0),r&&n.raw(`
|
|
3
|
+
`),n.info({message:`Using ${$("typedoc")} ${s} to generate reference documentation`,prefix:"typedoc"}),await e.hooks.callHook("typedoc:before",e);let i=e.options.rootDir;e.options.typedoc.output?i=e.options.typedoc.output:e.options.typedoc.format==="inline"&&o?i=m(o,"typedoc"):e.options.typedoc.format!=="json"&&(i=m(i,"api-docs")),await C(e.options.typedoc,e.options.entries,i,n),await e.hooks.callHook("typedoc:done",e)}};export{L as default};
|
package/dist/cli/index.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import{createCerebro as Q}from"@visulima/cerebro";import Z from"@visulima/cerebro/logger/pail";import{r as A,S as q,f as ee,e as te,g as se,i as ae,B as ne,T as ie,j as B,v as oe,l as re,d as ce}from"../packem_shared/index-BSqT47P3.js";import v,{cwd as L,exit as le}from"node:process";import{installPackage as h}from"@antfu/install-pkg";import{spinner as E,confirm as f,cancel as O,select as g,multiselect as G,intro as K,log as P,outro as U,isCancel as W}from"@clack/prompts";import{a as de,b as ue,q as pe,s as N,T as me,S as fe}from"../packem_shared/create-or-update-key-storage-CRDW-Kwa.js";import{P as D,w as b}from"../packem_shared/utils-Bsoe7qJG.js";import ge from"magic-string";import{exec as ye}from"tinyexec";import{PRODUCTION_ENV as F,DEVELOPMENT_ENV as we}from"@visulima/packem-share/constants";import{createJiti as be}from"jiti";import{writeFile as z,readFile as he}from"node:fs/promises";import{existsSync as V}from"node:fs";import{parseEnv as T}from"node:util";import{createInterface as ve}from"node:readline/promises";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
3
3
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
4
|
-
const
|
|
4
|
+
const J={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"]},ke=/defineConfig\s*\(\s*\{/,$e=/preset:\s*['"][^'"]+['"]/,Se=["typedoc","typedoc-plugin-markdown","typedoc-plugin-rename-defaults"],Ce=["@babel/core","@babel/preset-react"],je=["react","react-dom"],xe=["@babel/core","babel-preset-solid"],Pe=["solid-js"],Ee=["@babel/core","@babel/preset-react","babel-plugin-transform-hook-names"],De=["preact"],Ie=["unplugin-vue"],Me=["vue"],Ne=["rollup-plugin-svelte"],Le=["svelte"],k=(t,e,a)=>t.includes(`preset: '${e}'`)||t.includes(`preset: "${e}"`)||t.includes(`preset: '${e}',`)||t.includes(`preset: "${e}",`)||t.includes(a)||t.includes(`@visulima/packem/config/preset/${e}`),$=(t,e)=>{const{logger:a,magic:s,packemConfig:n}=t,i=ke.exec(n);if(i?.index!==void 0){const r=i.index+i[0].length;if(n.includes("preset:")){const o=$e.exec(n);if(o)s.replace(o[0],`preset: '${e}'`);else throw a.warn(`A preset already exists in the config. Please manually set it to '${e}'.`),new Error("Preset exists but is not a string")}else s.appendLeft(r,`
|
|
5
5
|
preset: '${e}',`)}else if(n.includes("transformer:"))s.replace("transformer:",`preset: '${e}',
|
|
6
|
-
transformer:`);else{const
|
|
7
|
-
preset: '${e}',`)}},
|
|
6
|
+
transformer:`);else{const r=n.indexOf("{");r!==-1&&s.appendLeft(r+1,`
|
|
7
|
+
preset: '${e}',`)}},Oe=async t=>{try{return((await ye("git",["status","--porcelain"],{nodeOptions:{cwd:t,stdio:["pipe","pipe","pipe"]}})).stdout?.trim().length??0)>0}catch{return!1}},_=async t=>{const e=b(t,"package.json"),a=await q(e,{resolveCatalogs:!0});return!!(a.devDependencies?.typescript??a.dependencies?.typescript)},Ve=async t=>{const e=await _(t),a=[...je],s=[...Ce];return e?s.push("@types/react","@types/react-dom"):await f({initialValue:!1,message:"Do you want to use TypeScript?"})&&s.push("typescript","@types/react","@types/react-dom"),{devPackages:s,packages:a}},S=async(t,e,a)=>{const{rootDirectory:s,spinner:n}=t;n.start("Installing packages"),await h(a,{cwd:s,dev:!1,silent:!0}),await h(e,{cwd:s,dev:!0,silent:!0}),n.stop("Installed packages")},Be=async t=>{const{logger:e,magic:a,packemConfig:s,packemConfigFormat:n,rootDirectory:i,spinner:r,transformerReplaceKey:o,transformerSearchKey:c}=t;if(s.includes("typedoc: typedocBuilder")||s.includes("@visulima/packem/builder/typedoc")){e.warn("Typedoc has already been added to the packem config.");return}n==="cjs"?a.prepend(`const typedocBuilder = require("@visulima/packem/builder/typedoc");
|
|
8
8
|
`):a.prepend(`import typedocBuilder from "@visulima/packem/builder/typedoc";
|
|
9
9
|
`),s.includes("builder: {")?a.replace("builder: {",`builder: {
|
|
10
10
|
typedoc: typedocBuilder,
|
|
11
|
-
`):a.replace(c,`${
|
|
11
|
+
`):a.replace(c,`${o}
|
|
12
12
|
builder: {
|
|
13
13
|
typedoc: typedocBuilder,
|
|
14
|
-
},`),e.info("Adding typedoc dependencies..."),
|
|
15
|
-
Typedoc added!`)},
|
|
16
|
-
React preset added!`)},
|
|
17
|
-
Solid preset added!`)},
|
|
18
|
-
Preact preset added!`)},
|
|
19
|
-
Vue preset added!`)},
|
|
20
|
-
Svelte preset added!`)},
|
|
14
|
+
},`),e.info("Adding typedoc dependencies..."),r.start("Installing packages"),await h(Se,{cwd:i,dev:!0,silent:!0}),r.stop("Installed packages"),e.success(`
|
|
15
|
+
Typedoc added!`)},Te=async t=>{const{logger:e,packemConfig:a}=t;if(k(a,"react","createReactPreset")){e.warn("React preset has already been added to the packem config.");return}$(t,"react");const{devPackages:s,packages:n}=await Ve(t.rootDirectory);e.info("Adding React dependencies..."),await S(t,s,n),e.success(`
|
|
16
|
+
React preset added!`)},Re=async t=>{const{logger:e,packemConfig:a}=t;if(k(a,"solid","createSolidPreset")){e.warn("Solid preset has already been added to the packem config.");return}$(t,"solid"),e.info("Adding Solid dependencies..."),await S(t,xe,Pe),e.success(`
|
|
17
|
+
Solid preset added!`)},Ae=async t=>{const e=await _(t),a=[...De],s=[...Ee];return e?s.push("@types/preact"):await f({initialValue:!1,message:"Do you want to use TypeScript?"})&&s.push("typescript","@types/preact"),{devPackages:s,packages:a}},qe=async t=>{const{logger:e,packemConfig:a}=t;if(k(a,"preact","createPreactPreset")){e.warn("Preact preset has already been added to the packem config.");return}$(t,"preact");const{devPackages:s,packages:n}=await Ae(t.rootDirectory);e.info("Adding Preact dependencies..."),await S(t,s,n),e.success(`
|
|
18
|
+
Preact preset added!`)},Ge=async t=>{const{logger:e,packemConfig:a}=t;if(k(a,"vue","createVuePreset")){e.warn("Vue preset has already been added to the packem config.");return}$(t,"vue"),e.info("Adding Vue dependencies..."),await S(t,Ie,Me),e.success(`
|
|
19
|
+
Vue preset added!`)},Ke=async t=>{const{logger:e,packemConfig:a}=t;if(k(a,"svelte","createSveltePreset")){e.warn("Svelte preset has already been added to the packem config.");return}$(t,"svelte"),e.info("Adding Svelte dependencies..."),await S(t,Ne,Le),e.success(`
|
|
20
|
+
Svelte preset added!`)},Ue=async()=>{const t=[],e=await g({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(t.push(e),e!=="tailwindcss"){let a=await G({message:"Pick extra loaders",options:[{label:"Sass",value:"sass"},{label:"Stylus",value:"stylus"},{label:"Less",value:"less"}],required:!1});if(a.includes("sass")){const s=await g({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"}]});s!=="sass"&&(a=a.filter(n=>n!=="sass"),a.push(s))}t.push(...a)}return{cssLoaders:t,mainCssLoader:e}},We=async(t,e,a,s)=>{if(!await f({initialValue:!1,message:"Do you want to minify your css?"}))return;const n=await g({message:"Pick a css minifier",options:[{label:"CSSNano",value:"cssnano"},{label:"Lightning CSS",value:"lightningcss"}]});return a.includes("lightningcss")||s.push(n),e==="cjs"?t.prepend(`const ${n}Minifier = require("@visulima/packem/css/minifier/${n.toLowerCase()}");
|
|
21
21
|
`):t.prepend(`import ${n}Minifier from "@visulima/packem/css/minifier/${n.toLowerCase()}";
|
|
22
|
-
`),n},
|
|
22
|
+
`),n},Fe=async t=>{const{logger:e,magic:a,packemConfig:s,packemConfigFormat:n,transformerReplaceKey:i,transformerSearchKey:r}=t;if(s.includes("css: {")||s.includes("@visulima/packem/css")){e.warn("Css loaders have already been added to the packem config.");return}const{cssLoaders:o,mainCssLoader:c}=await Ue(),l=[];for(const p of o)l.push(...J[p]);c!=="tailwindcss"&&o.push("sourceMap");for(const p of o){const d=p==="sass-embedded"||p==="node-sass"?"sass":p;n==="cjs"?a.prepend(`const ${d}Loader = require("@visulima/packem/css/loader/${d.toLowerCase()}");
|
|
23
23
|
`):a.prepend(`import ${d}Loader from "@visulima/packem/css/loader/${d.toLowerCase()}";
|
|
24
|
-
`)}const
|
|
25
|
-
css: {${
|
|
26
|
-
minifier: ${
|
|
27
|
-
loaders: [${
|
|
24
|
+
`)}const u=await We(a,n,o,l),m=o.map(p=>p==="sass-embedded"||p==="node-sass"?"sass":`${p}Loader`).join(", ");s.includes("rollup: {")?a.replace("rollup: {",`rollup: {
|
|
25
|
+
css: {${u?`
|
|
26
|
+
minifier: ${u}Minifier,`:""}
|
|
27
|
+
loaders: [${m}],
|
|
28
28
|
},
|
|
29
|
-
`):a.replace(
|
|
29
|
+
`):a.replace(r,`${i}
|
|
30
30
|
rollup: {
|
|
31
|
-
css: {${
|
|
32
|
-
minifier: ${
|
|
33
|
-
loaders: [${
|
|
31
|
+
css: {${u?`
|
|
32
|
+
minifier: ${u}Minifier,`:""}
|
|
33
|
+
loaders: [${m}],
|
|
34
34
|
},
|
|
35
|
-
},`),t.spinner.start("Installing packages"),await
|
|
36
|
-
CSS loaders added!`)},
|
|
35
|
+
},`),t.spinner.start("Installing packages"),await h(l,{cwd:t.rootDirectory,dev:!0,silent:!0}),t.spinner.stop("Installed packages"),e.success(`
|
|
36
|
+
CSS loaders added!`)},ze=t=>{t.addCommand({argument:{description:"Add a packem feature to your project",name:"feature",required:!0},description:"Add a optional packem feature to your project",execute:async({argument:e,logger:a,options:s})=>{const n=a,i=E(),r=D(L(),typeof s.dir=="string"?s.dir:".");let o;try{o=await A(r,s.config)}catch{n.error("Could not find a packem config file, please run `packem init` first.");return}if(await Oe(r)&&!await f({initialValue:!1,message:"Git repository has uncommitted changes. Do you want to proceed?"})){O("Operation cancelled.");return}const c=await de(o,{buffer:!1}),l=c.includes("import")?"esm":"cjs",u=new ge(c),m=" transformer,",p=c.includes(" transformer,")?" transformer,":" transformer",d={logger:n,magic:u,packemConfig:c,packemConfigFormat:l,rootDirectory:r,spinner:i,transformerReplaceKey:m,transformerSearchKey:p};e.includes("typedoc")&&await Be(d),e.includes("react")&&await Te(d),e.includes("solid")&&await Re(d),e.includes("preact")&&await qe(d),e.includes("vue")&&await Ge(d),e.includes("svelte")&&await Ke(d),e.includes("css")&&await Fe(d),await ue(o,u.toString(),{overwrite:!0})},name:"add",options:[{defaultValue:".",description:"The directory to build",name:"dir",type:String},{description:"Use a custom config file",name:"config",type:String}]})},Je=(t,e)=>{if(t==="rolldown")return`// Generated by \`packem\` first-run setup. See https://packem.dev for full options.
|
|
37
37
|
import { defineConfig } from "@visulima/packem/config";
|
|
38
38
|
|
|
39
39
|
export default defineConfig({
|
|
@@ -49,20 +49,20 @@ export default defineConfig({
|
|
|
49
49
|
declaration: true,
|
|
50
50
|
transformer,
|
|
51
51
|
});
|
|
52
|
-
`},
|
|
53
|
-
${
|
|
54
|
-
and create a packem.config.ts.`)}
|
|
55
|
-
`)){const n=s.trim();if(!n||n.startsWith("#"))continue;const
|
|
56
|
-
`:`const ${
|
|
57
|
-
`}return s&&a&&(
|
|
52
|
+
`},_e=async()=>{const t=await g({initialValue:"rollup",message:"Which bundler do you want to use?",options:[{hint:"stable, full feature set, supports DTS",label:"rollup",value:"rollup"},{hint:"experimental, fast — falls back to rollup for DTS",label:"rolldown",value:"rolldown"}]});if(W(t))throw O("Setup cancelled."),new Error("Packem setup was cancelled.");return t},He=async()=>{const t=await g({initialValue:"esbuild",message:"Which transformer do you want to use?",options:[{hint:"fast, widely used",label:"esbuild",value:"esbuild"},{hint:"fastest, Rust-based",label:"oxc",value:"oxc"},{hint:"TypeScript-aware, Rust-based",label:"swc",value:"swc"},{hint:"minimal, JS-based",label:"sucrase",value:"sucrase"}]});if(W(t))throw O("Setup cancelled."),new Error("Packem setup was cancelled.");return t},Xe=async(t,e)=>{if(t.length===0)return;const a=E();a.start(`Installing ${t.join(", ")}`);try{await h(t,{cwd:e,dev:!0,silent:!0}),a.stop(`Installed ${t.join(", ")}`)}catch(s){throw a.stop(`Failed to install ${t.join(", ")}`),s}},Ye=async t=>{if(await ee(t))return;if(!(process.stdout.isTTY&&!process.env.CI)){const i=await te(["rollup","esbuild"],t);throw new Error(`No packem.config found. Run packem in an interactive terminal to generate one, or install the defaults manually:
|
|
53
|
+
${i}
|
|
54
|
+
and create a packem.config.ts.`)}K(pe("Packem first-run setup")),P.info("No packem.config found — let's create one.");const e=await _e(),a=e==="rolldown"?void 0:await He(),s=[e];e==="rolldown"&&s.push("rollup"),a&&s.push(se[a]),await Xe(s,t);const n=b(t,"packem.config.ts");await z(n,Je(e,a),"utf8"),P.success(`Created ${n}`),U("Setup complete — continuing with build.")},Qe=/^([^#:=]+)=(.*)$/,R=(t,e="PACKEM_")=>{const a={};for(const s of t.split(`
|
|
55
|
+
`)){const n=s.trim();if(!n||n.startsWith("#"))continue;const i=Qe.exec(n);if(i?.[1]){const r=i[1].trim();let o=i[2].trim();(o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'"))&&(o=o.slice(1,-1)),(!e||r.startsWith(e))&&(a[`process.env.${r}`]=JSON.stringify(o))}}return a},Ze=async(t,e,a="PACKEM_")=>{const s=D(e,t);if(!V(s))return{};const{readFile:n}=await import("node:fs/promises"),i=await n(s,"utf8"),r={};if(typeof T=="function")try{const o=T(i);for(const[c,l]of Object.entries(o))(!a||c.startsWith(a))&&(r[`process.env.${c}`]=JSON.stringify(l))}catch{return R(i,a)}else return R(i,a);return r},et=async(t,e,a,s,n)=>{const i=await A(e,n),r=await t.import(i,{default:!0,try:!0})??{};return{config:typeof r=="function"?await r(a,s):r,path:i}},tt=async(t,e)=>{switch(t){case"none":return{};case"preact":{const{createPreactPreset:a}=await import("../config/preset/preact.js");t=a();break}case"react":{const{createReactPreset:a}=await import("../config/preset/react.js");t=a();break}case"solid":{const{createSolidPreset:a}=await import("../config/preset/solid.js");t=a();break}case"svelte":{const{createSveltePreset:a}=await import("../config/preset/svelte.js");t=a();break}case"vue":{const{createVuePreset:a}=await import("../config/preset/vue.js");t=a();break}default:typeof t=="string"&&(t=await e.import(t)||{})}return typeof t=="function"&&(t=t()),t},st=t=>t.watch?"watch":t.jit?"jit":"build",at=t=>{let e;const a={};if(t.env)for(const s of t.env)s.key==="NODE_ENV"?e=s.value:a[`process.env.${s.key}`]=JSON.stringify(s.value);return{cliEnvVariables:a,nodeEnvironment:e}},nt=(t,e)=>{if(e!==void 0)return e;if(t.production)return F;if(t.development)return we},it=t=>{const e=[];if(t.external)for(const a of t.external)e.push(a.split(","));return e},ot=t=>{t.addCommand({description:"Demonstrate options required",execute:async({logger:e,options:a})=>{const s=a,n=st(s),{cliEnvVariables:i,nodeEnvironment:r}=at(s),o=nt(s,r),c=it(s),l=D(L(),s.dir??".");await Ye(l);const u=be(l,{debug:s.debug}),{config:m,path:p}=await et(u,l,o,n,s.config??void 0);e.debug("Using packem config found at",p);const d=s.envFile??m.envFile,j=s.envPrefix??m.envPrefix??"PACKEM_",w={};if(d){const y=await Ze(d,l,j);Object.assign(w,y)}Object.assign(w,i);const I=await tt(m.preset??"none",u);s.minify&&s.sourcemap===void 0&&(s.sourcemap=!0);try{const y=ae()(m,ne,I,{analyze:s.analyze,bundler:s.bundler,cjsInterop:s.cjsInterop,clean:s.clean,dtsOnly:s.dtsOnly,externals:c,killSignal:s.killSignal,minify:s.minify??o===F,onSuccess:s.onSuccess,rollup:{esbuild:{target:s.target},license:{path:s.license},metafile:s.metafile,...Object.keys(w).length>0||Object.keys(i).length>0?{replace:{values:w}}:{},resolveExternals:s.noExternal?{builtins:!1,deps:!1,devDeps:!1,optDeps:!1,peerDeps:!1}:{}},runtime:s.runtime,sourcemap:s.metafile||s.analyze||s.sourcemap,unbundle:s.unbundle,validation:s.validation===!1?!1:{},...s.exe?{exe:!0}:{},...s.typedoc?{typedoc:{format:"html"}}:{}});s.validation===!1&&!m.validation&&(y.validation=!1),await ie(l,n,o,e,s.debug??!1,y,s.tsconfig??void 0)}catch(y){e.error(y),le(1)}},name:"build",options:[{description:"Specify the bundler to use (rollup or rolldown)",name:"bundler",type:e=>{if(e==="rollup"||e==="rolldown")return e;throw new Error("Invalid bundler. Use 'rollup' or 'rolldown'.")}},{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=>{const[a,s]=e.split("=");return{key:a,value:s}}},{description:"Path to the .env file to load environment variables from",name:"env-file",type:String},{description:"Prefix for environment variables to load from .env file (default: PACKEM_)",name:"env-prefix",type:String},{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=>{if(e==="SIGTERM"||e==="SIGKILL")return e;throw new Error("Invalid kill signal. Use 'SIGTERM' or 'SIGKILL'.")}},{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=>{if(e==="node"||e==="browser")return e;throw new Error("Invalid runtime. Use 'node' or 'browser'.")}},{description:"Enable unbundle mode to preserve source file structure instead of bundling into a single file",name:"unbundle",type:Boolean},{description:"Bundle the output into a standalone executable via Node.js SEA (requires Node.js >= 25.7.0, single entry)",name:"exe",type:Boolean}]})},H=t=>t==="sass-embedded"||t==="node-sass"?"sass":t,rt=(t,e)=>{fe(b(t,"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:e?["es2022","dom","dom.iterable"]:["es2022"]}})},ct=(t,e,a,s,n)=>{let i="";if(t)for(const r of e){const o=H(r);i+=n?`import ${o}Loader from "@visulima/packem/css/loader/${o.toLowerCase()}";
|
|
56
|
+
`:`const ${o}Loader = require("@visulima/packem/css/loader/${o.toLowerCase()}");
|
|
57
|
+
`}return s&&a&&(i+=n?`import ${a}Minifier from "@visulima/packem/css/minifier/${a.toLowerCase()}";
|
|
58
58
|
`:`const ${a}Minifier = require("@visulima/packem/css/minifier/${a.toLowerCase()}");
|
|
59
|
-
`),
|
|
59
|
+
`),i},lt=(t,e,a,s)=>{if(!t&&!a)return"";let n=`,
|
|
60
60
|
rollup: {
|
|
61
|
-
css: {`;if(t){const
|
|
62
|
-
loaders: [${
|
|
61
|
+
css: {`;if(t){const i=s.map(r=>`${H(r)}Loader`).join(", ");n+=`
|
|
62
|
+
loaders: [${i}],`}return a&&e&&(n+=`
|
|
63
63
|
minifier: ${e}Minifier,`),n+=`
|
|
64
64
|
}
|
|
65
|
-
}`,n},
|
|
65
|
+
}`,n},dt=(t,e,a,s,n)=>t?`import { defineConfig } from "@visulima/packem/config";
|
|
66
66
|
import transformer from "@visulima/packem/transformer/${e}";
|
|
67
67
|
${s}
|
|
68
68
|
export default defineConfig({
|
|
@@ -76,8 +76,8 @@ module.exports = defineConfig({
|
|
|
76
76
|
runtime: ${a},
|
|
77
77
|
transformer${n}
|
|
78
78
|
});
|
|
79
|
-
`,
|
|
80
|
-
`;return t?(e.info("[dry-run] package.json changes:"),e.info("Old content:"),console.info(a),e.info("New content:"),console.info(
|
|
79
|
+
`,ut=t=>{const e=[];return t.dependencies&&e.push(...Object.keys(t.dependencies)),t.devDependencies&&e.push(...Object.keys(t.devDependencies)),e},pt=async(t,e,a,s)=>{if(t===void 0&&!e){const i=await f({message:"Do you want to install TypeScript?"});return i&&s.push("typescript@latest"),i}const n=a.devDependencies?.typescript??a.dependencies?.typescript??"unknown";return P.message(`TypeScript version ${n} is already installed`),t},mt=async(t,e,a)=>{let s=t;return e.includes("esbuild")?s="esbuild":e.includes("@swc/core")?s="swc":e.includes("sucrase")&&(s="sucrase"),s!==void 0?(P.message(`Transformer ${s} is already installed.`),s):(s=await g({message:"Pick a transformer",options:[{label:"esbuild",value:"esbuild"},{label:"swc",value:"swc"},{label:"Sucrase",value:"sucrase"},{label:"OXC",value:"oxc"}]}),s&&s!=="oxc"&&!e.includes(s)&&await f({message:`Do you want to install ${s}?`})&&a.push(s==="swc"?"@swc/core":s),s)},ft=async t=>{if(N(b(t,"tsconfig.json")))return;const e=await f({message:"Do you want to use generate a tsconfig.json?"}),a=await f({message:"Do you want to run your code in the DOM?"});if(e){const s=E();s.start("Generating tsconfig.json"),rt(t,!!a),s.stop("")}},gt=async t=>{if(!t.includes("sass"))return t;const e=await g({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"}]});return e==="sass"?t:[...t.filter(a=>a!=="sass"),e]},yt=async t=>{const e=[],a=await g({message:"Pick a css loader",options:[{label:"PostCSS",value:"postcss"},{hint:"experimental",label:"Lightning CSS",value:"lightningcss"}]});e.push(a);const s=await G({message:"Pick your loaders",options:[{label:"Sass",value:"sass"},{label:"Stylus",value:"stylus"},{label:"Less",value:"less"}],required:!1}),n=await gt(s);if(e.push(...n),await f({message:`Do you want to install "${e.join('", "')}"?`}))for(const i of e)t.push(...J[i]);return e.push("sourceMap"),e},wt=async(t,e)=>{const a=await g({message:"Pick a css minifier",options:[{label:"CSSNano",value:"cssnano"},{label:"Lightning CSS",value:"lightningcss"}]});return t.includes("lightningcss")||await f({message:`Do you want to install "${a}"?`})&&e.push(a),a},bt=t=>{t.addCommand({description:"Initialize packem configuration",execute:async({logger:e,options:a})=>{const s=a,n=e;if(K("Welcome to packem setup"),N(b(s.dir??".","packem.config.ts"))){n.info("Packem project already initialized, you can use `packem build` to build your project");return}const i=D(L(),s.dir??"."),r=b(i,"package.json");if(!N(r))throw new Error("No package.json found in the directory");const o=await q(r,{resolveCatalogs:!0}),c=ut(o),l=!!(o.devDependencies?.typescript??o.dependencies?.typescript),u=[];s.typescript=await pt(s.typescript,l,o,u),await ft(i),s.runtime??=await g({message:"Pick a build runtime",options:[{label:"Node",value:"node"},{label:"Browser",value:"browser"}]}),s.transformer=await mt(s.transformer,c,u),s.css??=await f({initialValue:!1,message:"Do you want to use css in your project?"});const m=s.css?await yt(u):[];s.cssMinifier??=await f({initialValue:!1,message:"Do you want to minify your css?"});const p=s.cssMinifier?await wt(m,u):void 0,d=s.css??!1,j=s.cssMinifier??!1,w=l||o.type==="module",I=lt(d,p,j,m),y=ct(d,m,p,j,w),Y=dt(w,s.transformer??"",s.runtime??"",y,I),x=E(),M=l?"ts":"js";u.length>0&&(x.start("Installing packages"),await h(u,{cwd:i,dev:!0,silent:!0}),x.stop("Installed packages")),x.start(`Creating packem.config.${M}`),me(b(i,`packem.config.${M}`),Y),x.stop(`Created packem.config.${M}`),U("Now you can run `packem build` to build your project")},name:"init",options:[{defaultValue:".",description:"The directory to initialize",name:"dir",type:String},{description:"Choose a transformer",name:"transformer",type:e=>{if(typeof e=="string"&&["esbuild","sucrase","swc"].includes(e))return e;throw new Error("Invalid transformer, please choose one of 'swc', 'sucrase' or 'esbuild'")}},{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:e=>{if(e==="node"||e==="browser")return e;throw new Error("Invalid runtime. Use 'node' or 'browser'.")}}]})},X={bunchee:"@visulima/packem",tsup:"@visulima/packem","tsup-node":"@visulima/packem",unbuild:"@visulima/packem"},ht={dependencies:`^${B.version}`,devDependencies:`^${B.version}`,peerDependencies:"*"},vt=(t,e,a,s)=>{const n={};for(const i of Object.keys(t))i===e?n[a]=s??t[e]:n[i]=t[i];return n},kt=/\bunbuild\b/g,$t=/\bbunchee\b/g,St=/\btsup(?:-node)?/g,Ct=/\bbuild\b/g,jt=[{from:"tsup",rewrite:t=>t.replaceAll(St,"packem build").replaceAll(Ct,"build")},{from:"unbuild",rewrite:t=>t.replaceAll(kt,"packem build")},{from:"bunchee",rewrite:t=>t.replaceAll($t,"packem build")}],xt=(t,e,a)=>{let s=e,n=!1;for(const i of Object.keys(X))s.includes(i)&&(a.info(`Migrating \`${t}\` script from ${i} to packem`),n=!0,s=s.replaceAll(new RegExp(String.raw`\b${i}\b`,"g"),"packem").replaceAll(new RegExp(String.raw`\b${i}-node\b`,"g"),"packem"));for(const{from:i,rewrite:r}of jt)s.includes(i)&&(a.info(`Migrating \`${t}\` script from ${i} to packem`),n=!0,s=r(s));return n?s:void 0},Pt=(t,e)=>{const a={...t};let s=!1;for(const n of Object.keys(a)){const i=xt(n,a[n],e);i!==void 0&&(a[n]=i,s=!0)}return{found:s,scripts:a}},Et=(t,e)=>{const a={...t};let s=!1;for(const[n,i]of Object.entries(ht)){let r=a[n];for(const[o,c]of Object.entries(X))r?.[o]&&(e.info(`Migrating \`${n}\` from ${o} to ${c}.`),s=!0,r=vt(r,o,c,i),a[n]=r)}return{found:s,pkg:a}},Dt=(t,e)=>{const a=["tsup","unbuild","bunchee"];for(const s of a)t[s]&&e.info(`Found \`${s}\` config field in package.json. Consider moving to packem.config.ts`)},It=async(t,e)=>{if(!V("package.json"))return e.error("No package.json found"),!1;const a=await he("package.json","utf8"),s=JSON.parse(a),{found:n,pkg:i}=Et(s,e);let r=n;if(i.scripts){const{found:c,scripts:l}=Pt(i.scripts,e);c&&(i.scripts=l,r=!0)}if(Dt(i,e),!r)return e.warn("No migratable bundler dependencies found in package.json"),!1;const o=`${JSON.stringify(i,void 0,a.includes(" ")?" ":2)}
|
|
80
|
+
`;return t?(e.info("[dry-run] package.json changes:"),e.info("Old content:"),console.info(a),e.info("New content:"),console.info(o)):(await z("package.json",o),e.success("Migrated `package.json`")),!0},Mt=["tsup.config.ts","tsup.config.cts","tsup.config.mts","tsup.config.js","tsup.config.cjs","tsup.config.mjs","tsup.config.json","build.config.ts","build.config.cts","build.config.mts","build.config.js","build.config.cjs","build.config.mjs","bunchee.config.ts","bunchee.config.cts","bunchee.config.mts","bunchee.config.js","bunchee.config.cjs","bunchee.config.mjs"],Nt=t=>{let e=!1;for(const a of Mt)V(a)&&(t.info(`Found config file \`${a}\`. Consider creating packem.config.ts instead.`),t.warn("Manual migration required for config files. See https://www.visulima.com/docs/package/packem"),e=!0);return e||t.warn("No bundler config files found"),e},Lt=async({cwd:t,dryRun:e,logger:a})=>{if(e)a.info("Dry run enabled. No changes will be made.");else{const n=ve({input:v.stdin,output:v.stdout});a.warn(`
|
|
81
81
|
|
|
82
82
|
Before proceeding, review the migration guide at https://www.visulima.com/docs/package/packem, as this process will modify your files.
|
|
83
|
-
Uncommitted changes will be lost. Use the --dry-run flag to preview changes without applying them.`);const
|
|
83
|
+
Uncommitted changes will be lost. Use the --dry-run flag to preview changes without applying them.`);const i=await n.question("Continue? (Y/n) ");if(n.close(),!(i.toLowerCase()==="y"||i==="")){a.error("Migration cancelled."),v.exitCode=1;return}}t&&v.chdir(t);let s=!1;await It(e,a)&&(s=!0),Nt(a)&&(s=!0),s?a.success("Migration completed. Remember to run install command with your package manager."):(a.error("No migration performed."),v.exitCode=1)},Ot=t=>{t.addCommand({description:"Migrate from other bundlers (tsup, unbuild, bunchee, etc.) to packem",execute:async({logger:e,options:a})=>{const s=a;await Lt({cwd:s.cwd,dryRun:s.dryRun,logger:e})},name:"migrate",options:[{defaultValue:".",description:"The directory to migrate",name:"cwd",type:String},{description:"Preview changes without applying them",name:"dry-run",type:Boolean}]})};try{require("node:module").enableCompileCache?.()||require("v8-compile-cache")}catch{}const C=Q("packem",{logger:Z({reporters:[new ce({error:{hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0}})],scope:"packem"}),packageName:re,packageVersion:oe});bt(C);ot(C);ze(C);Ot(C);C.run({shouldExitProcess:!1});
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BuildConfig, a as BuildConfigFunction, b as BuildPreset } from "../packem_shared/types.d-
|
|
1
|
+
import { B as BuildConfig, a as BuildConfigFunction, b as BuildPreset } from "../packem_shared/types.d-ICL9GlqC.js";
|
|
2
2
|
export type { BuildHooks } from '@visulima/packem-share/types';
|
|
3
3
|
import '@arethetypeswrong/core';
|
|
4
4
|
import '@visulima/packem-plugins';
|
package/dist/config/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const n=e=>e,f=e=>e;export{n as defineConfig,f as definePreset};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BabelPluginConfig } from '@visulima/packem-plugins/babel';
|
|
2
|
-
import { B as BuildConfig } from "../../packem_shared/types.d-
|
|
2
|
+
import { B as BuildConfig } from "../../packem_shared/types.d-ICL9GlqC.js";
|
|
3
3
|
import '@arethetypeswrong/core';
|
|
4
4
|
import '@visulima/packem-plugins';
|
|
5
5
|
import '@visulima/packem-plugins/oxc';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
${t}`,map:void 0}}}),
|
|
1
|
+
const b=()=>({name:"packem:preact-alias-transform",transform(n,s){if(s.includes("/node_modules/"))return;let t=!1,e=n;if((e.includes('from "react"')||e.includes("from 'react'"))&&(e=e.replaceAll(/from\s+["']react["']/g,'from "preact/compat"'),t=!0),(e.includes('from "react-dom"')||e.includes("from 'react-dom'"))&&(e=e.replaceAll(/from\s+["']react-dom["']/g,'from "preact/compat"'),t=!0),(e.includes('from "react-dom/test-utils"')||e.includes("from 'react-dom/test-utils'"))&&(e=e.replaceAll(/from\s+["']react-dom\/test-utils["']/g,'from "preact/test-utils"'),t=!0),(e.includes('from "react-dom/client"')||e.includes("from 'react-dom/client'"))&&(e=e.replaceAll(/from\s+["']react-dom\/client["']/g,'from "preact/compat"'),t=!0),(e.includes('from "react/jsx-runtime"')||e.includes("from 'react/jsx-runtime'"))&&(e=e.replaceAll(/from\s+["']react\/jsx-runtime["']/g,'from "preact/jsx-runtime"'),t=!0),!!t)return{code:e,map:void 0}}}),y=(n,s)=>({name:"packem:preact-devtools",transform(t,e){return!this.getModuleInfo(e)?.isEntry||s&&!n||t.includes("preact/debug")||t.includes("preact/devtools")?void 0:{code:`import "${s?"preact/devtools":"preact/debug"}";
|
|
2
|
+
${t}`,map:void 0}}}),A=(n={})=>{const{devtoolsInProd:s=!1,plugins:t,presets:e}=n,l=[],d=[["@babel/preset-react",{importSource:"preact",runtime:"automatic"}]];l.push("babel-plugin-transform-hook-names");const i=[...l,...Array.isArray(t)?t:[]],m=[...d,...Array.isArray(e)?e:[]];return{hooks:{"rollup:options":(p,a)=>{const c=p.options.rollup.babel,u=p.environment==="production";if(c&&typeof c=="object"&&c.presets){const r=c.presets.findIndex(o=>Array.isArray(o)&&o[0]==="@babel/preset-react");if(r!==-1){const o=c.presets[r];c.presets[r]=[o[0],{...typeof o[1]=="object"&&o[1]!==null?o[1]:{},development:!u}]}}if(!a.input&&!a.plugins)return;Array.isArray(a.plugins)||(a.plugins=[]);const f=b();a.plugins.some(r=>typeof r=="object"&&r!==null&&"name"in r&&r.name==="packem:preact-alias-transform"||Array.isArray(r)&&r[0]&&typeof r[0]=="object"&&"name"in r[0]&&r[0].name==="packem:preact-alias-transform")||a.plugins.unshift(f);const g=y(s,u);a.plugins.some(r=>typeof r=="object"&&r!==null&&"name"in r&&r.name==="packem:preact-devtools"||Array.isArray(r)&&r[0]&&typeof r[0]=="object"&&"name"in r[0]&&r[0].name==="packem:preact-devtools")||a.plugins.push(g)}},rollup:{alias:{entries:[{find:"react",replacement:"preact/compat"},{find:"react-dom",replacement:"preact/compat"},{find:"react-dom/test-utils",replacement:"preact/test-utils"},{find:"react/jsx-runtime",replacement:"preact/jsx-runtime"}]},babel:{plugins:i.length>0?i:void 0,presets:m.length>0?m:void 0}},validation:{dependencies:{hoisted:{exclude:["react","react-dom"]},unused:{exclude:["preact","react","react-dom"]}}}}};export{A as createPreactPreset};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BabelPluginConfig } from '@visulima/packem-plugins/babel';
|
|
2
|
-
import { B as BuildConfig } from "../../packem_shared/types.d-
|
|
2
|
+
import { B as BuildConfig } from "../../packem_shared/types.d-ICL9GlqC.js";
|
|
3
3
|
import '@arethetypeswrong/core';
|
|
4
4
|
import '@visulima/packem-plugins';
|
|
5
5
|
import '@visulima/packem-plugins/oxc';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const b=(d={})=>{const{compiler:o,plugins:n,presets:i}=d,p=[],l=[];if(o){const r=typeof o=="object"?o:{};p.push(["babel-plugin-react-compiler",{compilationMode:r.compilationMode??"infer",panicThreshold:r.panicThreshold??"critical_errors"}])}l.push(["@babel/preset-react",{runtime:"automatic"}]);const c=[...p,...Array.isArray(n)?n:[]],a=[...l,...Array.isArray(i)?i:[]];return{hooks:{"rollup:options":(r,u)=>{const t=r.options.rollup.babel;if(t&&typeof t=="object"&&t.presets){const s=t.presets.findIndex(e=>Array.isArray(e)&&e[0]==="@babel/preset-react");if(s!==-1){const e=t.presets[s];t.presets[s]=[e[0],{...typeof e[1]=="object"&&e[1]!==null?e[1]:{},development:r.environment==="development"}]}}}},rollup:{babel:{plugins:c.length>0?c:void 0,presets:a.length>0?a:void 0}},validation:{dependencies:{hoisted:{exclude:[]},unused:{exclude:["react","react-dom"]}}}}};export{b as createReactPreset};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BabelPluginConfig } from '@visulima/packem-plugins/babel';
|
|
2
|
-
import { B as BuildConfig } from "../../packem_shared/types.d-
|
|
2
|
+
import { B as BuildConfig } from "../../packem_shared/types.d-ICL9GlqC.js";
|
|
3
3
|
import '@arethetypeswrong/core';
|
|
4
4
|
import '@visulima/packem-plugins';
|
|
5
5
|
import '@visulima/packem-plugins/oxc';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const y=o=>{const e={contextToCustomElements:o?.contextToCustomElements??!0,delegateEvents:o?.delegateEvents??!0,generate:o?.generate??"dom",hydratable:o?.hydratable??!1,moduleName:o?.moduleName??"solid-js/web",wrapConditionals:o?.wrapConditionals??!0};return o?.builtIns!==void 0&&(e.builtIns=o.builtIns),e},j=(o,e,r,l)=>{if(!e||typeof e=="function")return o;let s=r;if(e.plugins){const i=Array.isArray(e.plugins)?e.plugins:[];s=[...r??[],...i]}let n=l;if(e.presets){const i=Array.isArray(e.presets)?e.presets:[];n=[...l??[],...i]}return{...o,...e,plugins:s&&s.length>0?s:void 0,presets:n&&n.length>0?n:void 0}},N=(o={})=>{const{babel:e,plugins:r,presets:l,solidOptions:s}=o,n=[],i=[],v=["babel-preset-solid",y(s)];i.push(v);const a=[...n,...Array.isArray(r)?r:[]],u=[...i,...Array.isArray(l)?l:[]],g={ast:!1,babelrc:!1,configFile:!1,plugins:a.length>0?a:void 0,presets:u.length>0?u:void 0,sourceMaps:!0},m={babel:j(g,e,a,u),resolve:{exportConditions:["solid"]}};return{externals:["solid-js","solid-js/web","solid-js/store"],hooks:{"rollup:options":(t,S)=>{const d=t.environment==="development"?"development":"production",p=d==="development",{runtime:b}=t.options,c=b==="node";t.options.rollup.replace||(t.options.rollup.replace={preventAssignment:!0,values:{}}),t.options.rollup.replace.values||(t.options.rollup.replace.values={});const f={[["import","meta","env","DEV"].join(".")]:p,[["import","meta","env","NODE_ENV"].join(".")]:JSON.stringify(d),[["import","meta","env","PROD"].join(".")]:!p,[["import","meta","env","SSR"].join(".")]:c,[["process","env","DEV"].join(".")]:JSON.stringify(String(p)),[["process","env","NODE_ENV"].join(".")]:JSON.stringify(d),[["process","env","PROD"].join(".")]:JSON.stringify(String(!p)),[["process","env","SSR"].join(".")]:JSON.stringify(String(c))};Object.assign(t.options.rollup.replace.values,f)}},rollup:m,validation:{dependencies:{hoisted:{exclude:[]},unused:{exclude:["solid-js"]}}}}};export{N as createSolidPreset};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{DEFAULT_EXTENSIONS as t}from"@visulima/packem-share/constants";import o from"rollup-plugin-svelte";const n=/\.svelte$/,i=(s={})=>{const{pluginOptions:e={}}=s;return{rollup:{plugins:[{enforce:"pre",plugin:o({compilerOptions:{generate:"client",runes:!0,...e.compilerOptions},emitCss:!1,exclude:e.exclude,extensions:[".svelte"],include:e.include??[n],preprocess:e.preprocess})}],resolve:{browser:!0,exportConditions:["svelte"],extensions:[...t,".svelte"]}},validation:{dependencies:{hoisted:{exclude:[]},unused:{exclude:["svelte"]}}}}};export{i as createSveltePreset};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import n from"unplugin-vue/rollup";const u=/\.vue$/,c=(t={})=>{const{pluginOptions:e={}}=t;return{rollup:{plugins:[{enforce:"pre",plugin:n({customElement:e.customElement??!1,exclude:e.exclude,include:e.include??[u],template:e.template})}]},validation:{dependencies:{hoisted:{exclude:[]},unused:{exclude:["vue"]}}}}};export{c as createVuePreset};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConstructorOptions } from '@visulima/pail';
|
|
2
|
-
import { B as BuildConfig } from "./packem_shared/types.d-
|
|
3
|
-
export type { c as BuildEntry, d as BuildOptions, R as RollupBuildOptions } from "./packem_shared/types.d-
|
|
2
|
+
import { B as BuildConfig } from "./packem_shared/types.d-ICL9GlqC.js";
|
|
3
|
+
export type { c as BuildEntry, d as BuildOptions, R as RollupBuildOptions } from "./packem_shared/types.d-ICL9GlqC.js";
|
|
4
4
|
export type { TransformerFn, TransformerName } from '@visulima/packem-plugins';
|
|
5
5
|
import { Environment, Mode } from '@visulima/packem-share/types';
|
|
6
6
|
export type { BuildContext, BuildContextBuildAssetAndChunk, BuildContextBuildEntry, BuildHooks, Environment, Mode, Runtime } from '@visulima/packem-share/types';
|