@visulima/packem 2.0.0-alpha.89 → 2.0.0-alpha.90
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 +14 -0
- package/dist/builder/typedoc/index.d.ts +1 -1
- package/dist/cli/index.js +37 -37
- package/dist/config/index.d.ts +1 -1
- package/dist/config/preset/preact.d.ts +1 -1
- package/dist/config/preset/react.d.ts +1 -1
- package/dist/config/preset/solid.d.ts +1 -1
- package/dist/config/preset/svelte.d.ts +1 -1
- package/dist/config/preset/vue.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/packem_shared/default-mHB0zin0.js +1 -0
- package/dist/packem_shared/index-bcxmFLOh.js +249 -0
- package/dist/packem_shared/{oxcTransformPlugin-Dwvbw2jE-DgTjbGep.js → oxcTransformPlugin-Dwvbw2jE-BsmmBg7q.js} +1 -1
- package/dist/packem_shared/{types.d-ICL9GlqC.d.ts → types.d-BkLP91NJ.d.ts} +36 -1
- package/dist/rollup/plugins/oxc/oxc-transformer.js +1 -1
- package/package.json +4 -4
- package/dist/packem_shared/default-BKj8akkL.js +0 -1
- package/dist/packem_shared/index-BnalE1Ho.js +0 -245
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## @visulima/packem [2.0.0-alpha.90](https://github.com/visulima/packem/compare/@visulima/packem@2.0.0-alpha.89...@visulima/packem@2.0.0-alpha.90) (2026-06-16)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **packem:** add banner/footer injection for JS and declaration output ([fef6a45](https://github.com/visulima/packem/commit/fef6a45e71e7d94c5c1a5b0ba6897766cba68346))
|
|
6
|
+
* **packem:** route DTS through rolldown natively when rolldown is the bundler ([#208](https://github.com/visulima/packem/issues/208)) ([2802f4d](https://github.com/visulima/packem/commit/2802f4d72f6c4f2d1a74e51388b4771fb33fa3e6))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Dependencies
|
|
10
|
+
|
|
11
|
+
* **@visulima/rollup-plugin-css:** upgraded to 1.0.0-alpha.54
|
|
12
|
+
* **@visulima/rollup-plugin-dts:** upgraded to 1.0.0-alpha.35
|
|
13
|
+
* **@visulima/packem-rollup:** upgraded to 1.0.0-alpha.74
|
|
14
|
+
|
|
1
15
|
## @visulima/packem [2.0.0-alpha.89](https://github.com/visulima/packem/compare/@visulima/packem@2.0.0-alpha.88...@visulima/packem@2.0.0-alpha.89) (2026-06-15)
|
|
2
16
|
|
|
3
17
|
### 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-BkLP91NJ.js";
|
|
3
3
|
import '@arethetypeswrong/core';
|
|
4
4
|
import '@visulima/packem-plugins';
|
|
5
5
|
import '@visulima/packem-plugins/oxc';
|
package/dist/cli/index.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createCerebro as Q}from"@visulima/cerebro";import Z from"@visulima/cerebro/logger/pail";import{e as
|
|
2
|
+
import{createCerebro as Q}from"@visulima/cerebro";import Z from"@visulima/cerebro/logger/pail";import{e as A,S as q,m as ee,f as te,g as se,i as ae,B as ne,T as ie,j as R,v as re,l as oe,d as ce}from"../packem_shared/index-bcxmFLOh.js";import k,{cwd as O,exit as le}from"node:process";import{installPackage as h}from"@antfu/install-pkg";import{spinner as D,confirm as f,cancel as B,select as g,multiselect as G,intro as K,log as E,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-DHOKZmnD.js";import{P as L,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 J}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 _={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"],Le=["unplugin-vue"],Ie=["vue"],Me=["rollup-plugin-svelte"],Ne=["svelte"],$=(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}`),S=(t,e)=>{const{logger:a,magic:s,packemConfig:
|
|
5
|
-
preset: '${e}',`)}else if(
|
|
6
|
-
transformer:`);else{const r=
|
|
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}},H=async t=>{const e=b(t,"package.json"),a=await
|
|
4
|
+
const _={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"],Le=["unplugin-vue"],Ie=["vue"],Me=["rollup-plugin-svelte"],Ne=["svelte"],$=(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}`),S=(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
|
+
preset: '${e}',`)}else if(n.includes("transformer:"))s.replace("transformer:",`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}},H=async t=>{const e=b(t,"package.json"),a=await q(e,{resolveCatalogs:!0});return!!(a.devDependencies?.typescript??a.dependencies?.typescript)},Be=async t=>{const e=await H(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}},C=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")},Ve=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(
|
|
11
|
+
`):a.replace(c,`${o}
|
|
12
12
|
builder: {
|
|
13
13
|
typedoc: typedocBuilder,
|
|
14
|
-
},`),e.info("Adding typedoc dependencies..."),r.start("Installing packages"),await h(Se,{cwd:
|
|
15
|
-
Typedoc added!`)},
|
|
16
|
-
React preset added!`)},
|
|
17
|
-
Solid preset added!`)},Ae=async t=>{const e=await H(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($(a,"preact","createPreactPreset")){e.warn("Preact preset has already been added to the packem config.");return}S(t,"preact");const{devPackages:s,packages:
|
|
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!`)},Re=async t=>{const{logger:e,packemConfig:a}=t;if($(a,"react","createReactPreset")){e.warn("React preset has already been added to the packem config.");return}S(t,"react");const{devPackages:s,packages:n}=await Be(t.rootDirectory);e.info("Adding React dependencies..."),await C(t,s,n),e.success(`
|
|
16
|
+
React preset added!`)},Te=async t=>{const{logger:e,packemConfig:a}=t;if($(a,"solid","createSolidPreset")){e.warn("Solid preset has already been added to the packem config.");return}S(t,"solid"),e.info("Adding Solid dependencies..."),await C(t,xe,Pe),e.success(`
|
|
17
|
+
Solid preset added!`)},Ae=async t=>{const e=await H(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($(a,"preact","createPreactPreset")){e.warn("Preact preset has already been added to the packem config.");return}S(t,"preact");const{devPackages:s,packages:n}=await Ae(t.rootDirectory);e.info("Adding Preact dependencies..."),await C(t,s,n),e.success(`
|
|
18
18
|
Preact preset added!`)},Ge=async t=>{const{logger:e,packemConfig:a}=t;if($(a,"vue","createVuePreset")){e.warn("Vue preset has already been added to the packem config.");return}S(t,"vue"),e.info("Adding Vue dependencies..."),await C(t,Le,Ie),e.success(`
|
|
19
19
|
Vue preset added!`)},Ke=async t=>{const{logger:e,packemConfig:a}=t;if($(a,"svelte","createSveltePreset")){e.warn("Svelte preset has already been added to the packem config.");return}S(t,"svelte"),e.info("Adding Svelte dependencies..."),await C(t,Me,Ne),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
|
|
21
|
-
`):t.prepend(`import ${
|
|
22
|
-
`),
|
|
23
|
-
`):a.prepend(`import ${
|
|
24
|
-
`)}const
|
|
25
|
-
css: {${
|
|
26
|
-
minifier: ${
|
|
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
|
+
`):t.prepend(`import ${n}Minifier from "@visulima/packem/css/minifier/${n.toLowerCase()}";
|
|
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(..._[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
|
+
`):a.prepend(`import ${d}Loader from "@visulima/packem/css/loader/${d.toLowerCase()}";
|
|
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
27
|
loaders: [${m}],
|
|
28
28
|
},
|
|
29
|
-
`):a.replace(r,`${
|
|
29
|
+
`):a.replace(r,`${i}
|
|
30
30
|
rollup: {
|
|
31
|
-
css: {${
|
|
32
|
-
minifier: ${
|
|
31
|
+
css: {${u?`
|
|
32
|
+
minifier: ${u}Minifier,`:""}
|
|
33
33
|
loaders: [${m}],
|
|
34
34
|
},
|
|
35
|
-
},`),t.spinner.start("Installing packages"),await h(
|
|
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
|
|
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=D(),r=L(O(),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?"})){B("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 Ve(d),e.includes("react")&&await Re(d),e.includes("solid")&&await Te(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,35 +49,35 @@ export default defineConfig({
|
|
|
49
49
|
declaration: true,
|
|
50
50
|
transformer,
|
|
51
51
|
});
|
|
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
|
|
53
|
-
${
|
|
54
|
-
and create a packem.config.ts.`)}
|
|
55
|
-
`)){const
|
|
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",label:"rolldown",value:"rolldown"}]});if(W(t))throw B("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 B("Setup cancelled."),new Error("Packem setup was cancelled.");return t},Xe=async(t,e)=>{if(t.length===0)return;const a=D();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")),E.info("No packem.config found — let's create one.");const e=await _e(),a=e==="rolldown"?void 0:await He(),s=[e];a&&s.push(se[a]),await Xe(s,t);const n=b(t,"packem.config.ts");await z(n,Je(e,a),"utf8"),E.success(`Created ${n}`),U("Setup complete — continuing with build.")},Qe=/^([^#:=]+)=(.*)$/,T=(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=(t,e,a,s)=>{const n=J(t),i=Object.keys(n).length,r={};for(const[c,l]of Object.entries(n))(!e||c.startsWith(e))&&(r[`process.env.${c}`]=JSON.stringify(l));const o=Object.keys(r).length;return i>0&&o===0&&e?s?.warn(`Loaded 0 of ${String(i)} variables from "${a}"; none matched the "${e}" prefix.`):s?.info(`Loaded ${String(o)} of ${String(i)} variables from "${a}"${e?` (prefix "${e}")`:""}.`),r},et=async(t,e,a="PACKEM_",s)=>{const n=L(e,t);if(!V(n))return s?.warn(`Env file not found at "${n}"; no environment variables were loaded.`),{};const{readFile:i}=await import("node:fs/promises"),r=await i(n,"utf8");if(typeof J!="function")return T(r,a);try{return Ze(r,a,t,s)}catch{return T(r,a)}},tt=async(t,e,a,s,n)=>{const i=await A(e,n),r=await t.import(i,{default:!0})??{};return{config:typeof r=="function"?await r(a,s):r,path:i}},st=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,{default:!0})||{})}return typeof t=="function"&&(t=t()),t},at=t=>t.watch?"watch":t.jit?"jit":"build",nt=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}},it=(t,e)=>{if(e!==void 0)return e;if(t.production)return F;if(t.development)return we},rt=t=>{const e=[];if(t.external)for(const a of t.external)e.push(a.split(","));return e},ot=t=>{t.addCommand({description:"Build the package using the resolved packem configuration",execute:async({logger:e,options:a})=>{const s=a,n=at(s),{cliEnvVariables:i,nodeEnvironment:r}=nt(s),o=it(s,r),c=rt(s),l=L(O(),s.dir??".");await Ye(l);const u=be(l,{debug:s.debug}),{config:m,path:p}=await tt(u,l,o,n,s.config??void 0);e.debug("Using packem config found at",p);const d=s.envFile??m.envFile,x=s.envPrefix??m.envPrefix??"PACKEM_",w={};if(d){const y=await et(d,l,x,{info:v=>{e.info(v)},warn:v=>{e.warn(v)}});Object.assign(w,y)}Object.assign(w,i);const I=await st(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),s.cache===!1&&(y.fileCache=!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=e.indexOf("=");return a===-1?{key:e,value:""}:{key:e.slice(0,a),value:e.slice(a+1)}}},{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 (node, 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}]})},X=t=>t==="sass-embedded"||t==="node-sass"?"sass":t,ct=(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"]}})},lt=(t,e,a,s,n)=>{let i="";if(t)for(const r of e){const o=X(r);i+=n?`import ${o}Loader from "@visulima/packem/css/loader/${o.toLowerCase()}";
|
|
56
56
|
`:`const ${o}Loader = require("@visulima/packem/css/loader/${o.toLowerCase()}");
|
|
57
|
-
`}return s&&a&&(n
|
|
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},dt=(t,e,a,s)=>{if(!t&&!a)return"";let n=`,
|
|
60
60
|
rollup: {
|
|
61
|
-
css: {`;if(t){const
|
|
62
|
-
loaders: [${
|
|
63
|
-
minifier: ${e}Minifier,`),
|
|
61
|
+
css: {`;if(t){const i=s.map(r=>`${X(r)}Loader`).join(", ");n+=`
|
|
62
|
+
loaders: [${i}],`}return a&&e&&(n+=`
|
|
63
|
+
minifier: ${e}Minifier,`),n+=`
|
|
64
64
|
}
|
|
65
|
-
}`,
|
|
65
|
+
}`,n},ut=(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({
|
|
69
69
|
runtime: "${a}",
|
|
70
|
-
transformer${
|
|
70
|
+
transformer${n}
|
|
71
71
|
});
|
|
72
72
|
`:`const { defineConfig } = require("@visulima/packem/config");
|
|
73
73
|
const transformer = require("@visulima/packem/transformer/${e}");
|
|
74
74
|
${s}
|
|
75
75
|
module.exports = defineConfig({
|
|
76
76
|
runtime: ${a},
|
|
77
|
-
transformer${
|
|
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(o)):(await
|
|
79
|
+
`,pt=t=>{const e=[];return t.dependencies&&e.push(...Object.keys(t.dependencies)),t.devDependencies&&e.push(...Object.keys(t.devDependencies)),e},mt=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 E.message(`TypeScript version ${n} is already installed`),t},ft=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?(E.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)},gt=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=D();s.start("Generating tsconfig.json"),ct(t,!!a),s.stop("")}},yt=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]},wt=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 yt(s);if(e.push(...n),await f({message:`Do you want to install "${e.join('", "')}"?`}))for(const i of e)t.push(..._[i]);return e.push("sourceMap"),e},bt=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},ht=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=L(O(),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=pt(o),l=!!(o.devDependencies?.typescript??o.dependencies?.typescript),u=[];s.typescript=await mt(s.typescript,l,o,u),await gt(i),s.runtime??=await g({message:"Pick a build runtime",options:[{label:"Node",value:"node"},{label:"Browser",value:"browser"}]}),s.transformer=await ft(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 wt(u):[];s.cssMinifier??=await f({initialValue:!1,message:"Do you want to minify your css?"});const p=s.cssMinifier?await bt(m,u):void 0,d=s.css??!1,x=s.cssMinifier??!1,w=l||o.type==="module",I=dt(d,p,x,m),y=lt(d,m,p,x,w),v=ut(w,s.transformer??"",s.runtime??"",y,I),P=D(),M=l?"ts":"js";u.length>0&&(P.start("Installing packages"),await h(u,{cwd:i,dev:!0,silent:!0}),P.stop("Installed packages")),P.start(`Creating packem.config.${M}`),me(b(i,`packem.config.${M}`),v),P.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'.")}}]})},Y={bunchee:"@visulima/packem",tsup:"@visulima/packem","tsup-node":"@visulima/packem",unbuild:"@visulima/packem"},vt={dependencies:`^${R.version}`,devDependencies:`^${R.version}`,peerDependencies:"*"},kt=(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},$t=/\bunbuild\b/g,St=/\bbunchee\b/g,Ct=/\btsup(?:-node)?/g,jt=/\bbuild\b/g,xt=[{from:"tsup",rewrite:t=>t.replaceAll(Ct,"packem build").replaceAll(jt,"build")},{from:"unbuild",rewrite:t=>t.replaceAll($t,"packem build")},{from:"bunchee",rewrite:t=>t.replaceAll(St,"packem build")}],Pt=(t,e,a)=>{let s=e,n=!1;for(const i of Object.keys(Y))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 xt)s.includes(i)&&(a.info(`Migrating \`${t}\` script from ${i} to packem`),n=!0,s=r(s));return n?s:void 0},Et=(t,e)=>{const a={...t};let s=!1;for(const n of Object.keys(a)){const i=Pt(n,a[n],e);i!==void 0&&(a[n]=i,s=!0)}return{found:s,scripts:a}},Dt=(t,e)=>{const a={...t};let s=!1;for(const[n,i]of Object.entries(vt)){let r=a[n];for(const[o,c]of Object.entries(Y))r?.[o]&&(e.info(`Migrating \`${n}\` from ${o} to ${c}.`),s=!0,r=kt(r,o,c,i),a[n]=r)}return{found:s,pkg:a}},Lt=(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}=Dt(s,e);let r=n;if(i.scripts){const{found:c,scripts:l}=Et(i.scripts,e);c&&(i.scripts=l,r=!0)}if(Lt(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},Ot=async({cwd:t,dryRun:e,logger:a})=>{if(e)a.info("Dry run enabled. No changes will be made.");else{const n=ve({input:k.stdin,output:k.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."),k.exitCode=1;return}}t&&k.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."),k.exitCode=1)},Bt=t=>{t.addCommand({description:"Migrate from other bundlers (tsup, unbuild, bunchee, etc.) to packem",execute:async({logger:e,options:a})=>{const s=a;await Ot({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?.()}catch{}const j=Q("packem",{logger:Z({reporters:[new ce({error:{hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0}})],scope:"packem"}),packageName:oe,packageVersion:re});ht(j);ot(j);ze(j);Bt(j);j.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-BkLP91NJ.js";
|
|
2
2
|
export type { BuildHooks } from '@visulima/packem-share/types';
|
|
3
3
|
import '@arethetypeswrong/core';
|
|
4
4
|
import '@visulima/packem-plugins';
|
|
@@ -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-BkLP91NJ.js";
|
|
3
3
|
import '@arethetypeswrong/core';
|
|
4
4
|
import '@visulima/packem-plugins';
|
|
5
5
|
import '@visulima/packem-plugins/oxc';
|
|
@@ -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-BkLP91NJ.js";
|
|
3
3
|
import '@arethetypeswrong/core';
|
|
4
4
|
import '@visulima/packem-plugins';
|
|
5
5
|
import '@visulima/packem-plugins/oxc';
|
|
@@ -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-BkLP91NJ.js";
|
|
3
3
|
import '@arethetypeswrong/core';
|
|
4
4
|
import '@visulima/packem-plugins';
|
|
5
5
|
import '@visulima/packem-plugins/oxc';
|
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-BkLP91NJ.js";
|
|
3
|
+
export type { c as BuildEntry, d as BuildOptions, R as RollupBuildOptions } from "./packem_shared/types.d-BkLP91NJ.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';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as He}from"node:module";import{n as Ht,Z as xe,Y as Jt,J as Je,h as Se,y as yt,X as Gt,q as Ut,M as zt,a as Kt,A as be,K as Yt,k as Qt,b as Zt,c as Be,d as Xt,T as er}from"./packem_shared/index-BnalE1Ho.js";import{g as wt}from"./packem_shared/create-or-update-key-storage-DHOKZmnD.js";const tr=He(import.meta.url),ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:Q,Ge=t=>{if(typeof ie<"u"&&ie.versions&&ie.versions.node){const[e,r]=ie.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return ie.getBuiltinModule(t)}return tr(t)},Q=ie,{execFileSync:rr}=Ge("node:child_process"),ue=Ge("node:fs"),sr=Ge("node:tty"),Ue=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],ze=[12288,12288,65281,65376,65504,65510],Ke=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Ye=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Ae=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],ge=(t,e)=>{let r=0,s=Math.floor(t.length/2)-1;for(;r<=s;){const i=Math.floor((r+s)/2),o=i*2;if(e<t[o])s=i-1;else if(e>t[o+1])r=i+1;else return!0}return!1},ir=Ue[0],nr=Ue.at(-1),or=ze[0],ar=ze.at(-1),lr=Ke[0],cr=Ke.at(-1),ur=Ye[0],fr=Ye.at(-1),hr=Ae[0],gr=Ae.at(-1),nt=19968,[dr,pr]=mr(Ae);function mr(t){let e=t[0],r=t[1];for(let s=0;s<t.length;s+=2){const i=t[s],o=t[s+1];if(nt>=i&&nt<=o)return[i,o];o-i>r-e&&(e=i,r=o)}return[e,r]}const br=t=>t<ir||t>nr?!1:ge(Ue,t),yr=t=>t<or||t>ar?!1:ge(ze,t),wr=t=>t<lr||t>cr?!1:ge(Ke,t),$r=t=>t<ur||t>fr?!1:ge(Ye,t),vr=t=>t>=dr&&t<=pr?!0:t<hr||t>gr?!1:ge(Ae,t);function xr(t){return br(t)?"ambiguous":yr(t)?"fullwidth":wr(t)?"halfwidth":$r(t)?"narrow":vr(t)?"wide":"neutral"}function Sr(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function $t(t){return Sr(t),xr(t)}const vt=String.raw,ot=vt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,kr=()=>new RegExp(vt`\p{RI}{2}|(?)${ot}(?:\u200D${ot})*`,"gu"),ae=new Set(["\x1B",""]),Le="\x07",xt="[",Qe="m",ke="]8;;",Er=39,Tr=/[\u200B\uFEFF\u2060-\u2064]/g,Ar=new RegExp(`(?:\\${xt}(?<code>\\d+)m|\\${ke}(?<uri>.*)${Le})`),Lr=Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]])),le=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,ye=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,je=kr(),at=new Map,we=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,$e=t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other",Mr=(t,e)=>{const r=Math.floor(t/65536),s=t%65536;let i=at.get(r);if(i||(i=new Map,at.set(r,i)),i.has(s))return i.get(s);let o;if($e(t)==="latin")o=e.width.regular;else if($e(t)==="control")o=e.width.control;else if($e(t)==="wide")o=e.width.wide;else switch($t(t)){case"ambiguous":{o=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{o=e.width.fullWidth;break}case"wide":{o=e.width.wide;break}default:o=e.width.regular}return i.set(s,o),o},Or=t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,Ce=(t,e={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const r={truncation:{countAnsiEscapeCodes:e.countAnsiEscapeCodes??!1,ellipsis:e.ellipsis??"",ellipsisWidth:e.ellipsisWidth??(e.ellipsis?Ce(e.ellipsis,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:e.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:e.ambiguousIsNarrow??!1,ansi:e.ansiWidth??0,control:e.controlWidth??0,emoji:e.emojiWidth??2,fullWidth:e.fullWidth??2,halfWidth:e.halfWidth??1,regular:e.regularWidth??1,tab:e.tabWidth??8,wide:e.wideWidth??2}},s=Math.max(0,r.truncation.limit-r.truncation.ellipsisWidth),{length:i}=t,o=i>1e4;let a=0,n=0,c=i,u=!1;const l=t.includes("\x1B")||t.includes("");for(;a<i;){if(l&&(t[a]==="\x1B"||t[a]==="")){if(t.startsWith("\x1B]8;;",a)){const v="\x1B]8;;\x07",B=v.length,V=t.indexOf("\x07",a+5);if(V!==-1){const H=t.indexOf(v,V+1);if(H!==-1){const d=H+B,g=t.slice(V+1,H).replace(le,""),$=Ce(g,{ambiguousIsNarrow:r.width.ambiguousIsNarrow,ansiWidth:r.width.ansi,controlWidth:r.width.control,countAnsiEscapeCodes:!1,ellipsis:r.truncation.ellipsis,ellipsisWidth:r.truncation.ellipsisWidth,emojiWidth:r.width.emoji,fullWidth:r.width.fullWidth,halfWidth:r.width.halfWidth,limit:Math.max(0,s-n),regularWidth:r.width.regular,tabWidth:r.width.tab,wideWidth:r.width.wide}),I=$.width;if($.truncated)u=!0,c=Math.min(c,a);else if(n+I>s&&(c=Math.min(c,a),u=!0,n+I>r.truncation.limit))break;if(n+=I,a=d,u&&n>=r.truncation.limit)break;continue}}}if(le.lastIndex=a,le.test(t)){const v=le.lastIndex-a,B=r.truncation.countAnsiEscapeCodes?v:r.width.ansi;if(n+B>s&&(c=Math.min(c,a),n+B>r.truncation.limit)){u=!0;break}n+=B,a=le.lastIndex;continue}}const w=t.codePointAt(a);if(w===8203||w===65279||w>=8288&&w<=8292){a+=1;continue}if(w===9){if(n+r.width.tab>s&&(c=Math.min(c,a),n+r.width.tab>r.truncation.limit)){u=!0;break}n+=r.width.tab,a+=1;continue}if(we.lastIndex=a,we.test(t)){const v=(we.lastIndex-a)*r.width.regular;if(n+v>s){const B=Math.floor((s-n)/r.width.regular);if(c=Math.min(c,a+B),n+v>r.truncation.limit){u=!0;break}}n+=v,a=we.lastIndex;continue}if((w<=31||w>=127&&w<=159)&&(ye.lastIndex=a,ye.test(t))){const v=(ye.lastIndex-a)*r.width.control;if(n+v>s&&(c=Math.min(c,a+Math.floor((s-n)/r.width.control)),n+v>r.truncation.limit)){u=!0;break}n+=v,a=ye.lastIndex;continue}if(je.lastIndex=a,je.test(t)){if(n+r.width.emoji>s&&(c=Math.min(c,a),n+r.width.emoji>r.truncation.limit)){u=!0;break}n+=r.width.emoji,a=je.lastIndex;continue}const N=t.codePointAt(a)??0;if(Or(N)){a+=N>65535?2:1;continue}let k;if(o)k=Mr(N,r);else switch($e(N)){case"control":{k=r.width.control;break}case"latin":{k=r.width.regular;break}case"wide":{k=r.width.wide;break}case"zero":{k=0;break}default:switch($t(N)){case"ambiguous":{k=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{k=r.width.fullWidth;break}case"wide":{k=r.width.wide;break}default:k=r.width.regular}}if(n+k>s&&(c=Math.min(c,a),n+k>r.truncation.limit)){u=!0;break}n+=k,a+=N>65535?2:1}let h=n,p=!1;return u&&r.truncation.limit>=r.truncation.ellipsisWidth&&(h=r.truncation.limit,p=!0),{ellipsed:p,index:u?c:i,truncated:u,width:h}},Z=(t,e={})=>Ce(t,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,Br=/\x1B\[(\d+)m/;class St{activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(e){const r=Br.exec(e);if(!r)return;const s=Number.parseInt(r[1],10);switch(s){case 0:{this.activeForeground=void 0,this.activeBackground=void 0,this.activeFormatting=[];break}case 39:{this.activeForeground=void 0;break}case 49:{this.activeBackground=void 0;break}default:if(s>=30&&s<=37||s>=90&&s<=97)this.activeForeground=e;else if(s>=40&&s<=47||s>=100&&s<=107)this.activeBackground=e;else if([1,2,3,4,7,8,9].includes(s))this.activeFormatting.push(e);else if([22,23,24,27,28,29].includes(s)){const i={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[s];i&&(this.activeFormatting=this.activeFormatting.filter(o=>!o.includes(i)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const e=[];if(this.activeFormatting.length>0){const r={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].toReversed().forEach(s=>{const i=r[s];i&&e.push(i)})}return this.activeForeground&&e.push("\x1B[39m"),this.activeBackground&&e.push("\x1B[49m"),e.join("")}}const kt=(t,e)=>{if(!ae.has(t[e]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const r=!0,s=t.slice(e+1,e+1+ke.length).join("")===ke;return{isInsideEscape:r,isInsideLinkEscape:s}},jr=(t,e={})=>{const r=new St;let s="",i=!1,o="",a="",n=!1;const c=[...t];for(let u=0;u<c.length;u++){const l=c[u];if(l&&ae.has(l)){if(s){const k=e.getWidth?.(s)??0,v={isEscapeSequence:!1,isGrapheme:!0,text:s,width:k};if(n&&(v.isHyperlink=!0,v.hyperlinkUrl=a),e.onSegment?.(v,r)===!1)return;s=""}i=!0,o=l;const w=kt(c,u),{isInsideLinkEscape:N}=w;if(N){let k=u+1;for(a="";k<c.length;){const B=c[k];if(B===Le)break;a+=B,k+=1}a=a.slice(4);const v={hyperlinkUrl:a,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(e.onSegment?.(v,r)===!1)return;u=k,n=!0,i=!1,o="";continue}if(u+1<c.length&&c[u+1]==="\\"&&n){const k={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(e.onSegment?.(k,r)===!1)return;n=!1,a="",u+=1,i=!1,o="";continue}}if(i){if(o!==l&&(o+=l),l===Qe){i=!1,r.processEscape(o);const w={isEscapeSequence:!0,isGrapheme:!1,text:o,width:0};if(e.onSegment?.(w,r)===!1)return;o=""}continue}s+=l;const h=e.getWidth?.(s)??0,p={isEscapeSequence:!1,isGrapheme:!0,text:s,width:h};if(n&&(p.isHyperlink=!0,p.hyperlinkUrl=a),e.onSegment?.(p,r)===!1)return;s=""}if(s){const u=e.getWidth?.(s)??0,l={isEscapeSequence:!1,isGrapheme:!0,text:s,width:u};n&&(l.isHyperlink=!0,l.hyperlinkUrl=a),e.onSegment?.(l,r)}if(o){const u={isEscapeSequence:!0,isGrapheme:!1,text:o,width:0};e.onSegment?.(u,r)}},lt=t=>`${ae.values().next().value}${xt}${String(t)}${Qe}`,ct=t=>`${ae.values().next().value}${ke}${t}${Le}`,Nr=t=>{if(t.length===0)return"";if(t.length===1)return t[0];let e="",r,s;const i=t.join(`
|
|
1
|
+
import{createRequire as He}from"node:module";import{n as Ht,Z as xe,Y as Jt,J as Je,h as Se,y as yt,X as Gt,q as Ut,M as zt,a as Kt,A as be,K as Yt,k as Qt,b as Zt,c as Be,d as Xt,T as er}from"./packem_shared/index-bcxmFLOh.js";import{g as wt}from"./packem_shared/create-or-update-key-storage-DHOKZmnD.js";const tr=He(import.meta.url),ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:Q,Ge=t=>{if(typeof ie<"u"&&ie.versions&&ie.versions.node){const[e,r]=ie.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return ie.getBuiltinModule(t)}return tr(t)},Q=ie,{execFileSync:rr}=Ge("node:child_process"),ue=Ge("node:fs"),sr=Ge("node:tty"),Ue=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],ze=[12288,12288,65281,65376,65504,65510],Ke=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Ye=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Ae=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],ge=(t,e)=>{let r=0,s=Math.floor(t.length/2)-1;for(;r<=s;){const i=Math.floor((r+s)/2),o=i*2;if(e<t[o])s=i-1;else if(e>t[o+1])r=i+1;else return!0}return!1},ir=Ue[0],nr=Ue.at(-1),or=ze[0],ar=ze.at(-1),lr=Ke[0],cr=Ke.at(-1),ur=Ye[0],fr=Ye.at(-1),hr=Ae[0],gr=Ae.at(-1),nt=19968,[dr,pr]=mr(Ae);function mr(t){let e=t[0],r=t[1];for(let s=0;s<t.length;s+=2){const i=t[s],o=t[s+1];if(nt>=i&&nt<=o)return[i,o];o-i>r-e&&(e=i,r=o)}return[e,r]}const br=t=>t<ir||t>nr?!1:ge(Ue,t),yr=t=>t<or||t>ar?!1:ge(ze,t),wr=t=>t<lr||t>cr?!1:ge(Ke,t),$r=t=>t<ur||t>fr?!1:ge(Ye,t),vr=t=>t>=dr&&t<=pr?!0:t<hr||t>gr?!1:ge(Ae,t);function xr(t){return br(t)?"ambiguous":yr(t)?"fullwidth":wr(t)?"halfwidth":$r(t)?"narrow":vr(t)?"wide":"neutral"}function Sr(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function $t(t){return Sr(t),xr(t)}const vt=String.raw,ot=vt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,kr=()=>new RegExp(vt`\p{RI}{2}|(?)${ot}(?:\u200D${ot})*`,"gu"),ae=new Set(["\x1B",""]),Le="\x07",xt="[",Qe="m",ke="]8;;",Er=39,Tr=/[\u200B\uFEFF\u2060-\u2064]/g,Ar=new RegExp(`(?:\\${xt}(?<code>\\d+)m|\\${ke}(?<uri>.*)${Le})`),Lr=Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]])),le=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,ye=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,je=kr(),at=new Map,we=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,$e=t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other",Mr=(t,e)=>{const r=Math.floor(t/65536),s=t%65536;let i=at.get(r);if(i||(i=new Map,at.set(r,i)),i.has(s))return i.get(s);let o;if($e(t)==="latin")o=e.width.regular;else if($e(t)==="control")o=e.width.control;else if($e(t)==="wide")o=e.width.wide;else switch($t(t)){case"ambiguous":{o=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{o=e.width.fullWidth;break}case"wide":{o=e.width.wide;break}default:o=e.width.regular}return i.set(s,o),o},Or=t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,Ce=(t,e={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const r={truncation:{countAnsiEscapeCodes:e.countAnsiEscapeCodes??!1,ellipsis:e.ellipsis??"",ellipsisWidth:e.ellipsisWidth??(e.ellipsis?Ce(e.ellipsis,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:e.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:e.ambiguousIsNarrow??!1,ansi:e.ansiWidth??0,control:e.controlWidth??0,emoji:e.emojiWidth??2,fullWidth:e.fullWidth??2,halfWidth:e.halfWidth??1,regular:e.regularWidth??1,tab:e.tabWidth??8,wide:e.wideWidth??2}},s=Math.max(0,r.truncation.limit-r.truncation.ellipsisWidth),{length:i}=t,o=i>1e4;let a=0,n=0,c=i,u=!1;const l=t.includes("\x1B")||t.includes("");for(;a<i;){if(l&&(t[a]==="\x1B"||t[a]==="")){if(t.startsWith("\x1B]8;;",a)){const v="\x1B]8;;\x07",B=v.length,V=t.indexOf("\x07",a+5);if(V!==-1){const H=t.indexOf(v,V+1);if(H!==-1){const d=H+B,g=t.slice(V+1,H).replace(le,""),$=Ce(g,{ambiguousIsNarrow:r.width.ambiguousIsNarrow,ansiWidth:r.width.ansi,controlWidth:r.width.control,countAnsiEscapeCodes:!1,ellipsis:r.truncation.ellipsis,ellipsisWidth:r.truncation.ellipsisWidth,emojiWidth:r.width.emoji,fullWidth:r.width.fullWidth,halfWidth:r.width.halfWidth,limit:Math.max(0,s-n),regularWidth:r.width.regular,tabWidth:r.width.tab,wideWidth:r.width.wide}),I=$.width;if($.truncated)u=!0,c=Math.min(c,a);else if(n+I>s&&(c=Math.min(c,a),u=!0,n+I>r.truncation.limit))break;if(n+=I,a=d,u&&n>=r.truncation.limit)break;continue}}}if(le.lastIndex=a,le.test(t)){const v=le.lastIndex-a,B=r.truncation.countAnsiEscapeCodes?v:r.width.ansi;if(n+B>s&&(c=Math.min(c,a),n+B>r.truncation.limit)){u=!0;break}n+=B,a=le.lastIndex;continue}}const w=t.codePointAt(a);if(w===8203||w===65279||w>=8288&&w<=8292){a+=1;continue}if(w===9){if(n+r.width.tab>s&&(c=Math.min(c,a),n+r.width.tab>r.truncation.limit)){u=!0;break}n+=r.width.tab,a+=1;continue}if(we.lastIndex=a,we.test(t)){const v=(we.lastIndex-a)*r.width.regular;if(n+v>s){const B=Math.floor((s-n)/r.width.regular);if(c=Math.min(c,a+B),n+v>r.truncation.limit){u=!0;break}}n+=v,a=we.lastIndex;continue}if((w<=31||w>=127&&w<=159)&&(ye.lastIndex=a,ye.test(t))){const v=(ye.lastIndex-a)*r.width.control;if(n+v>s&&(c=Math.min(c,a+Math.floor((s-n)/r.width.control)),n+v>r.truncation.limit)){u=!0;break}n+=v,a=ye.lastIndex;continue}if(je.lastIndex=a,je.test(t)){if(n+r.width.emoji>s&&(c=Math.min(c,a),n+r.width.emoji>r.truncation.limit)){u=!0;break}n+=r.width.emoji,a=je.lastIndex;continue}const N=t.codePointAt(a)??0;if(Or(N)){a+=N>65535?2:1;continue}let k;if(o)k=Mr(N,r);else switch($e(N)){case"control":{k=r.width.control;break}case"latin":{k=r.width.regular;break}case"wide":{k=r.width.wide;break}case"zero":{k=0;break}default:switch($t(N)){case"ambiguous":{k=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{k=r.width.fullWidth;break}case"wide":{k=r.width.wide;break}default:k=r.width.regular}}if(n+k>s&&(c=Math.min(c,a),n+k>r.truncation.limit)){u=!0;break}n+=k,a+=N>65535?2:1}let h=n,p=!1;return u&&r.truncation.limit>=r.truncation.ellipsisWidth&&(h=r.truncation.limit,p=!0),{ellipsed:p,index:u?c:i,truncated:u,width:h}},Z=(t,e={})=>Ce(t,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,Br=/\x1B\[(\d+)m/;class St{activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(e){const r=Br.exec(e);if(!r)return;const s=Number.parseInt(r[1],10);switch(s){case 0:{this.activeForeground=void 0,this.activeBackground=void 0,this.activeFormatting=[];break}case 39:{this.activeForeground=void 0;break}case 49:{this.activeBackground=void 0;break}default:if(s>=30&&s<=37||s>=90&&s<=97)this.activeForeground=e;else if(s>=40&&s<=47||s>=100&&s<=107)this.activeBackground=e;else if([1,2,3,4,7,8,9].includes(s))this.activeFormatting.push(e);else if([22,23,24,27,28,29].includes(s)){const i={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[s];i&&(this.activeFormatting=this.activeFormatting.filter(o=>!o.includes(i)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const e=[];if(this.activeFormatting.length>0){const r={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].toReversed().forEach(s=>{const i=r[s];i&&e.push(i)})}return this.activeForeground&&e.push("\x1B[39m"),this.activeBackground&&e.push("\x1B[49m"),e.join("")}}const kt=(t,e)=>{if(!ae.has(t[e]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const r=!0,s=t.slice(e+1,e+1+ke.length).join("")===ke;return{isInsideEscape:r,isInsideLinkEscape:s}},jr=(t,e={})=>{const r=new St;let s="",i=!1,o="",a="",n=!1;const c=[...t];for(let u=0;u<c.length;u++){const l=c[u];if(l&&ae.has(l)){if(s){const k=e.getWidth?.(s)??0,v={isEscapeSequence:!1,isGrapheme:!0,text:s,width:k};if(n&&(v.isHyperlink=!0,v.hyperlinkUrl=a),e.onSegment?.(v,r)===!1)return;s=""}i=!0,o=l;const w=kt(c,u),{isInsideLinkEscape:N}=w;if(N){let k=u+1;for(a="";k<c.length;){const B=c[k];if(B===Le)break;a+=B,k+=1}a=a.slice(4);const v={hyperlinkUrl:a,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(e.onSegment?.(v,r)===!1)return;u=k,n=!0,i=!1,o="";continue}if(u+1<c.length&&c[u+1]==="\\"&&n){const k={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(e.onSegment?.(k,r)===!1)return;n=!1,a="",u+=1,i=!1,o="";continue}}if(i){if(o!==l&&(o+=l),l===Qe){i=!1,r.processEscape(o);const w={isEscapeSequence:!0,isGrapheme:!1,text:o,width:0};if(e.onSegment?.(w,r)===!1)return;o=""}continue}s+=l;const h=e.getWidth?.(s)??0,p={isEscapeSequence:!1,isGrapheme:!0,text:s,width:h};if(n&&(p.isHyperlink=!0,p.hyperlinkUrl=a),e.onSegment?.(p,r)===!1)return;s=""}if(s){const u=e.getWidth?.(s)??0,l={isEscapeSequence:!1,isGrapheme:!0,text:s,width:u};n&&(l.isHyperlink=!0,l.hyperlinkUrl=a),e.onSegment?.(l,r)}if(o){const u={isEscapeSequence:!0,isGrapheme:!1,text:o,width:0};e.onSegment?.(u,r)}},lt=t=>`${ae.values().next().value}${xt}${String(t)}${Qe}`,ct=t=>`${ae.values().next().value}${ke}${t}${Le}`,Nr=t=>{if(t.length===0)return"";if(t.length===1)return t[0];let e="",r,s;const i=t.join(`
|
|
2
2
|
`),o=[...i];let a=0;for(const[n,c]of o.entries()){if(e+=c,ae.has(c)){const l=Ar.exec(i.slice(a))?.groups??{};if(l.code!==void 0){const h=Number.parseFloat(l.code);r=h===Er?void 0:h}else l.uri!==void 0&&(s=l.uri.length===0?void 0:l.uri)}const u=Lr.get(Number(r));o[n+1]===`
|
|
3
3
|
`?(s&&(e+=ct("")),r&&u&&(e+=lt(u))):c===`
|
|
4
4
|
`&&(r&&u&&(e+=lt(r)),s&&(e+=ct(s))),a+=c.length}return e},Et=/(?=\s)|(?<=\s)/,Tt=/^\s+$/,Ne=t=>{if(!t.includes("\x1B"))return t;let e=t;return t.includes("\x1B[30m")&&(e+="\x1B[39m"),t.includes("\x1B[42m")&&(e+="\x1B[49m"),e},te=t=>{const e=t.split(" ");let r=e.length;for(;r>0&&Z(e[r-1])===0;)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},At=(t,e,r)=>{if(t.length===0)return[""];if(e<=0)return[t];const s=[],i=new St;let o="",a=0,n=!1,c=!1,u="",l=0;for(;l<t.length;){const h=t[l];if(ae.has(h)){n=!0,u=h,o+=h,c=kt([...t],l).isInsideLinkEscape,l+=1;continue}if(n){u+=h,o+=h,c?h===Le&&(n=c=!1):h===Qe&&(n=!1,i.processEscape(u)),l+=1;continue}const p=Z(h),w=h===" ";if(p===0){o+=h,l+=1;continue}if(a+p>e&&(o&&s.push(o+i.getEndEscapesForAllActiveAttributes()),o=i.getStartEscapesForAllActiveAttributes(),a=Z(o),w&&r)){for(;l<t.length&&t[l]===" ";)l+=1;continue}if(o+=h,a+=p,a===e&&l<t.length-1&&(s.push(o+i.getEndEscapesForAllActiveAttributes()),o=i.getStartEscapesForAllActiveAttributes(),a=Z(o),l+1<t.length&&t[l+1]===" "&&r)){for(l+=1;l<t.length&&t[l]===" ";)l+=1;continue}l+=1}return o&&s.push(o+i.getEndEscapesForAllActiveAttributes()),r?s.map(h=>te(h)):s},Ir=(t,e,r)=>{if(t.length===0)return[];const s=r?t.trim():t;if(s.length===0)return[];const i=[];let o="",a=0;return jr(s,{getWidth:Z,onSegment:(n,c)=>{const u=n.text??"";if(n.isEscapeSequence)o+=u;else{const l=u===" ";if(n.width===0)return o+=u,!0;if(a+n.width>e&&(o&&i.push(o),o=c.getStartEscapesForAllActiveAttributes(),a=0,l))return r||i.push(c.getStartEscapesForAllActiveAttributes()+u),!0;o+=u,a+=n.width}return!0}}),o&&i.push(o),r?i.map(n=>te(n)):i},Pr=(t,e,r)=>{if(t.length===0)return[];const s=r?t.trim():t;if(s.length===0)return[];const i=s.split(Et),o=[];let a="",n=0,c=0;for(;c<i.length;){const u=i[c],l=Tt.test(u),h=Z(u);if(u.length===0){c+=1;continue}if(r&&l&&n===0){c+=1;continue}if(n+h>e&&n>0){r?o.push(te(a)):o.push(a),a="",n=0;continue}a+=u,n+=h,c+=1}return a&&(r?o.push(te(a)):o.push(a)),o},Fr=(t,e,r)=>{if(t.length===0)return[];const s=r?t.trim():t;if(s.length===0)return[];const i=s.split(Et),o=[];let a="",n=0,c=0;for(;c<i.length;){const u=i[c],l=Tt.test(u),h=Z(u);if(u.length===0){c+=1;continue}if(r&&l&&n===0){c+=1;continue}if(h>e){a&&o.push(Ne(r?te(a):a));const p=At(u,e,r);if(p.length>0){for(let w=0;w<p.length-1;w+=1)o.push(p[w]);a=p.at(-1),n=Z(a)}else a="",n=0;c+=1;continue}if(n+h>e&&n>0&&(o.push(Ne(r?te(a):a)),a="",n=0,r&&l)){c+=1;continue}a+=u,n+=h,c+=1}return a&&o.push(Ne(r?te(a):a)),o},fe={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},Rr=(t,e={})=>{const{removeZeroWidthCharacters:r=!0,trim:s=!0,width:i=80,wrapMode:o=fe.PRESERVE_WORDS}=e;if(s&&t.trim()==="")return"";let a=t.normalize("NFC").replaceAll(`\r
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as s,t as a}from"./oxcTransformPlugin-Dwvbw2jE-BsmmBg7q.js";export{s as oxcResolvePlugin,a as oxcTransformPlugin};
|