@visulima/packem 1.0.0-alpha.94 → 1.0.0-alpha.96
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/cli.mjs +107 -8
- package/dist/config.d.cts +2 -2
- package/dist/config.d.mts +2 -2
- package/dist/config.d.ts +2 -2
- package/dist/create-bundler.cjs +67 -68
- package/dist/create-bundler.d.cts +2 -2
- package/dist/create-bundler.d.mts +2 -2
- package/dist/create-bundler.d.ts +2 -2
- package/dist/create-bundler.mjs +58 -59
- package/dist/rollup/plugins/esbuild/index.d.cts +0 -2
- package/dist/rollup/plugins/esbuild/index.d.ts +0 -2
- package/dist/rollup/plugins/esbuild/index.mjs +2 -2
- package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.cts +1 -3
- package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.mts +1 -1
- package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.ts +1 -3
- package/dist/rollup/plugins/sucrase/index.d.cts +0 -2
- package/dist/rollup/plugins/sucrase/index.d.ts +0 -2
- package/dist/rollup/plugins/sucrase/index.mjs +1 -1
- package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.cts +1 -3
- package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.mts +1 -1
- package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.ts +1 -3
- package/dist/rollup/plugins/swc/swc-plugin.d.cts +0 -2
- package/dist/rollup/plugins/swc/swc-plugin.d.ts +0 -2
- package/dist/rollup/plugins/swc/swc-plugin.mjs +1 -1
- package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.cts +1 -3
- package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.mts +1 -1
- package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.ts +1 -3
- package/dist/shared/{constants-DcRh98q_.mjs → constants-bGKeOK8V.mjs} +1 -1
- package/dist/shared/{types-htgF7Xtw.d.ts → types-BTXISiJt.d.ts} +2 -1
- package/dist/shared/{types-DsYp-kFd.d.cts → types-BzEjQ1ba.d.cts} +2 -1
- package/dist/shared/{types-BvTSoulI.d.mts → types-DIVjp2ON.d.mts} +2 -1
- package/package.json +11 -13
- package/dist/cli.cjs +0 -16
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var O=Object.defineProperty;var g=(e,r)=>O(e,"name",{value:r,configurable:!0});import{existsSync as k,statSync as M}from"node:fs";import{createFilter as P}from"@rollup/pluginutils";import{join as R,resolve as S,dirname as W,extname as $}from"@visulima/path";import{formatMessages as A,transform as _,build as C}from"esbuild";import{
|
|
1
|
+
var O=Object.defineProperty;var g=(e,r)=>O(e,"name",{value:r,configurable:!0});import{existsSync as k,statSync as M}from"node:fs";import{createFilter as P}from"@rollup/pluginutils";import{join as R,resolve as S,dirname as W,extname as $}from"@visulima/path";import{formatMessages as A,transform as _,build as C}from"esbuild";import{b as F,c as L}from"../../../shared/constants-bGKeOK8V.mjs";import{u as y}from"../../../shared/resolve-file-BcJmI4Tm.mjs";import{findCacheDir as I}from"@visulima/find-cache-dir";import{readFile as U}from"@visulima/fs";import{init as X,parse as q}from"es-module-lexer";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
2
2
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
3
|
-
var G=Object.defineProperty,T=g((e,r)=>G(e,"name",{value:r,configurable:!0}),"n");const z=T(async(e,r)=>{r.length>0&&(await A(r,{color:!0,kind:"warning"})).forEach(l=>e.warn(l))},"warn");var B=Object.defineProperty,x=g((e,r)=>B(e,"name",{value:r,configurable:!0}),"t");const H=x(e=>{if(e==="es")return"esm";if(e==="cjs")return e},"getEsbuildFormat"),J=x(({sourceMap:e=!0,...r})=>async function(l,s,i){if(r.minify||r.minifyWhitespace||r.minifyIdentifiers||r.minifySyntax){const n=H(i.format),c=await _(l,{format:n,loader:"js",sourcemap:e,...r});if(await z(this,c.warnings),c.code)return{code:c.code,map:c.map||null}}return null},"getRenderChunk");var K=Object.defineProperty,
|
|
3
|
+
var G=Object.defineProperty,T=g((e,r)=>G(e,"name",{value:r,configurable:!0}),"n");const z=T(async(e,r)=>{r.length>0&&(await A(r,{color:!0,kind:"warning"})).forEach(l=>e.warn(l))},"warn");var B=Object.defineProperty,x=g((e,r)=>B(e,"name",{value:r,configurable:!0}),"t");const H=x(e=>{if(e==="es")return"esm";if(e==="cjs")return e},"getEsbuildFormat"),J=x(({sourceMap:e=!0,...r})=>async function(l,s,i){if(r.minify||r.minifyWhitespace||r.minifyIdentifiers||r.minifySyntax){const n=H(i.format),c=await _(l,{format:n,loader:"js",sourcemap:e,...r});if(await z(this,c.warnings),c.code)return{code:c.code,map:c.map||null}}return null},"getRenderChunk");var K=Object.defineProperty,j=g((e,r)=>K(e,"name",{value:r,configurable:!0}),"o");const D=j(e=>e.replaceAll("\\","/"),"slash"),N=j(async e=>{const r=await I("@visulima/packem/optimize-deps",{create:!0,cwd:e.cwd});if(!r)throw new Error('[packem:optimize-deps]: failed to find or create cache directory "node_modules/.cache/packem/optimize_deps".');await X,await C({absWorkingDir:e.cwd,bundle:!0,entryPoints:e.include,format:"esm",ignoreAnnotations:!0,metafile:!0,outdir:r,sourcemap:e.sourceMap,splitting:!0,...e.esbuildOptions,plugins:[{name:"optimize-deps",async setup(s){s.onResolve({filter:/.*/},async i=>{if(e.exclude?.includes(i.path))return{external:!0};if(i.pluginData?.__resolving_dep_path__)return null;if(e.include.includes(i.path)){const n=await s.resolve(i.path,{kind:"import-statement",pluginData:{__resolving_dep_path__:!0},resolveDir:i.resolveDir});return n.errors.length>0||n.warnings.length>0?n:{namespace:"optimize-deps",path:i.path,pluginData:{absolute:n.path,resolveDir:i.resolveDir}}}return null}),s.onLoad({filter:/.*/,namespace:"optimize-deps"},async i=>{const{absolute:n,resolveDir:c}=i.pluginData,u=await U(n),[,f]=q(u);return{contents:f.length>0?`export * from '${D(n)}'`:`module.exports = require('${D(n)}')`,resolveDir:c}})}},...e.esbuildOptions?.plugins??[]]});const l=new Map;for(const s of e.include)l.set(s,{file:R(r,`${s}.js`)});return{cacheDir:r,optimized:l}},"optimizeDeps");var Q=Object.defineProperty,V=g((e,r)=>Q(e,"name",{value:r,configurable:!0}),"w");const le=V(({exclude:e,include:r,loaders:l,logger:s,optimizeDeps:i,sourceMap:n=!0,...c})=>{const u=L;if(l!==void 0)for(let[t,a]of Object.entries(l))t=t.startsWith(".")?t:`.${t}`,typeof a=="string"?u[t]=a:a||delete u[t];const f=Object.keys(u),E=new RegExp(`\\.(${f.map(t=>t.slice(1)).join("|")})$`),w=P(r??E,e??F);let d,b=process.cwd();const h=new Map;return{async buildStart(){!i||d||(d=await N({cwd:b,sourceMap:n,...i}),s.debug("optimized %O",d.optimized))},name:"esbuild",options({context:t}){return t&&(b=t),null},renderChunk:J({...c,sourceMap:n}),async resolveId(t,a,{isEntry:v}){if(!a||v||!w(t)||t.startsWith("\0"))return null;if(d?.optimized.has(t)){const o=d.optimized.get(t);if(o)return s.debug("resolved %s to %s",t,o.file),o.file}const p=h.get(t);if(p!==void 0)return p;if(a&&t.startsWith(".")){const o=S(a?W(a):process.cwd(),t);let m=y(f,o);if(m||!m&&k(o)&&M(o).isDirectory()&&(m=y(f,o,!0),m))return h.set(t,m),m}return h.set(t,null),null},async transform(t,a){if(!w(a)||d?.optimized.has(a))return null;const v=$(a),p=u[v];if(s.debug("transforming %s with %s loader",a,p),!p)return null;const o=await _(t,{format:["base64","binary","dataurl","text","json"].includes(p)?"esm":void 0,loader:p,sourcefile:a.replace(/\.[cm]ts/,".ts"),sourcemap:n,...c});return await z(this,o.warnings),o.code?{code:o.code,map:o.map||null}:null}}},"default");export{le as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as IsolatedDeclarationsResult } from '../../../shared/types-
|
|
1
|
+
import { I as IsolatedDeclarationsResult } from '../../../shared/types-BzEjQ1ba.cjs';
|
|
2
2
|
import '@rollup/plugin-alias';
|
|
3
3
|
import '@rollup/plugin-commonjs';
|
|
4
4
|
import '@rollup/plugin-json';
|
|
@@ -23,6 +23,4 @@ import '../../../shared/types-CzGE8V_d.cjs';
|
|
|
23
23
|
|
|
24
24
|
declare const isolatedDeclarationsOxcTransformer: (id: string, code: string) => IsolatedDeclarationsResult;
|
|
25
25
|
|
|
26
|
-
export { };
|
|
27
|
-
|
|
28
26
|
export = isolatedDeclarationsOxcTransformer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as IsolatedDeclarationsResult } from '../../../shared/types-
|
|
1
|
+
import { I as IsolatedDeclarationsResult } from '../../../shared/types-DIVjp2ON.mjs';
|
|
2
2
|
import '@rollup/plugin-alias';
|
|
3
3
|
import '@rollup/plugin-commonjs';
|
|
4
4
|
import '@rollup/plugin-json';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as IsolatedDeclarationsResult } from '../../../shared/types-
|
|
1
|
+
import { I as IsolatedDeclarationsResult } from '../../../shared/types-BTXISiJt.js';
|
|
2
2
|
import '@rollup/plugin-alias';
|
|
3
3
|
import '@rollup/plugin-commonjs';
|
|
4
4
|
import '@rollup/plugin-json';
|
|
@@ -23,6 +23,4 @@ import '../../../shared/types-CzGE8V_d.js';
|
|
|
23
23
|
|
|
24
24
|
declare const isolatedDeclarationsOxcTransformer: (id: string, code: string) => IsolatedDeclarationsResult;
|
|
25
25
|
|
|
26
|
-
export { };
|
|
27
|
-
|
|
28
26
|
export = isolatedDeclarationsOxcTransformer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var d=Object.defineProperty;var u=(n,e)=>d(n,"name",{value:e,configurable:!0});import{existsSync as E,statSync as y}from"node:fs";import{createFilter as v}from"@rollup/pluginutils";import{resolve as g,dirname as x}from"@visulima/path";import{transform as
|
|
1
|
+
var d=Object.defineProperty;var u=(n,e)=>d(n,"name",{value:e,configurable:!0});import{existsSync as E,statSync as y}from"node:fs";import{createFilter as v}from"@rollup/pluginutils";import{resolve as g,dirname as x}from"@visulima/path";import{transform as D}from"sucrase";import{b as P,D as S}from"../../../shared/constants-bGKeOK8V.mjs";import{u as m}from"../../../shared/resolve-file-BcJmI4Tm.mjs";var b=Object.defineProperty,h=u((n,e)=>b(n,"name",{value:e,configurable:!0}),"f");const N=h(({exclude:n,extensions:e=S,include:f,...p})=>{const l=v(f,n??P),a=new Map;return{async resolveId(t,r,{isEntry:c}){if(!r||c||!l(t)||t.startsWith("\0"))return null;const s=a.get(t);if(s!==void 0)return s;if(r&&t.startsWith(".")){const i=g(r?x(r):process.cwd(),t);let o=m(e,i);if(o||!o&&E(i)&&y(i).isDirectory()&&(o=m(e,i,!0),o))return a.set(t,o),o}return a.set(t,null),null},async transform(t,r){if(!l(r))return null;const{code:c,sourceMap:s}=D(t,{...p,filePath:r,sourceMapOptions:{compiledFilename:r}});return{code:c,map:s}}}},"sucrasePlugin");export{N as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as IsolatedDeclarationsResult } from '../../../shared/types-
|
|
1
|
+
import { I as IsolatedDeclarationsResult } from '../../../shared/types-BzEjQ1ba.cjs';
|
|
2
2
|
import '@rollup/plugin-alias';
|
|
3
3
|
import '@rollup/plugin-commonjs';
|
|
4
4
|
import '@rollup/plugin-json';
|
|
@@ -23,6 +23,4 @@ import '../../../shared/types-CzGE8V_d.cjs';
|
|
|
23
23
|
|
|
24
24
|
declare const isolatedDeclarationsSwcTransformer: (id: string, code: string) => Promise<IsolatedDeclarationsResult>;
|
|
25
25
|
|
|
26
|
-
export { };
|
|
27
|
-
|
|
28
26
|
export = isolatedDeclarationsSwcTransformer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as IsolatedDeclarationsResult } from '../../../shared/types-
|
|
1
|
+
import { I as IsolatedDeclarationsResult } from '../../../shared/types-DIVjp2ON.mjs';
|
|
2
2
|
import '@rollup/plugin-alias';
|
|
3
3
|
import '@rollup/plugin-commonjs';
|
|
4
4
|
import '@rollup/plugin-json';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as IsolatedDeclarationsResult } from '../../../shared/types-
|
|
1
|
+
import { I as IsolatedDeclarationsResult } from '../../../shared/types-BTXISiJt.js';
|
|
2
2
|
import '@rollup/plugin-alias';
|
|
3
3
|
import '@rollup/plugin-commonjs';
|
|
4
4
|
import '@rollup/plugin-json';
|
|
@@ -23,6 +23,4 @@ import '../../../shared/types-CzGE8V_d.js';
|
|
|
23
23
|
|
|
24
24
|
declare const isolatedDeclarationsSwcTransformer: (id: string, code: string) => Promise<IsolatedDeclarationsResult>;
|
|
25
25
|
|
|
26
|
-
export { };
|
|
27
|
-
|
|
28
26
|
export = isolatedDeclarationsSwcTransformer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var d=Object.defineProperty;var f=(o,e)=>d(o,"name",{value:e,configurable:!0});import{existsSync as E,statSync as y}from"node:fs";import{createFilter as v}from"@rollup/pluginutils";import{transform as w}from"@swc/core";import{resolve as g,dirname as x}from"@visulima/path";import{
|
|
1
|
+
var d=Object.defineProperty;var f=(o,e)=>d(o,"name",{value:e,configurable:!0});import{existsSync as E,statSync as y}from"node:fs";import{createFilter as v}from"@rollup/pluginutils";import{transform as w}from"@swc/core";import{resolve as g,dirname as x}from"@visulima/path";import{b as D,D as S}from"../../../shared/constants-bGKeOK8V.mjs";import{u as m}from"../../../shared/resolve-file-BcJmI4Tm.mjs";var b=Object.defineProperty,F=f((o,e)=>b(o,"name",{value:e,configurable:!0}),"a");const T=F(({exclude:o,extensions:e=S,include:u,...p})=>{const l=v(u,o??D),a=new Map;return{async resolveId(t,r,{isEntry:c}){if(!r||c||!l(t)||t.startsWith("\0"))return null;const s=a.get(t);if(s!==void 0)return s;if(r&&t.startsWith(".")){const i=g(r?x(r):process.cwd(),t);let n=m(e,i);if(n||!n&&E(i)&&y(i).isDirectory()&&(n=m(e,i,!0),n))return a.set(t,n),n}return a.set(t,null),null},async transform(t,r){if(!l(r))return null;const{code:c,map:s}=await w(t,{...p,configFile:!1,filename:r,swcrc:!1});return{code:c,map:s}}}},"swcPlugin");export{T as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TranspileOptions } from 'typescript';
|
|
2
|
-
import { I as IsolatedDeclarationsResult } from '../../../shared/types-
|
|
2
|
+
import { I as IsolatedDeclarationsResult } from '../../../shared/types-BzEjQ1ba.cjs';
|
|
3
3
|
import '@rollup/plugin-alias';
|
|
4
4
|
import '@rollup/plugin-commonjs';
|
|
5
5
|
import '@rollup/plugin-json';
|
|
@@ -24,6 +24,4 @@ import '../../../shared/types-CzGE8V_d.cjs';
|
|
|
24
24
|
|
|
25
25
|
declare const isolatedDeclarationsTypescriptTransformer: (id: string, code: string, transformOptions?: TranspileOptions) => Promise<IsolatedDeclarationsResult>;
|
|
26
26
|
|
|
27
|
-
export { };
|
|
28
|
-
|
|
29
27
|
export = isolatedDeclarationsTypescriptTransformer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TranspileOptions } from 'typescript';
|
|
2
|
-
import { I as IsolatedDeclarationsResult } from '../../../shared/types-
|
|
2
|
+
import { I as IsolatedDeclarationsResult } from '../../../shared/types-DIVjp2ON.mjs';
|
|
3
3
|
import '@rollup/plugin-alias';
|
|
4
4
|
import '@rollup/plugin-commonjs';
|
|
5
5
|
import '@rollup/plugin-json';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TranspileOptions } from 'typescript';
|
|
2
|
-
import { I as IsolatedDeclarationsResult } from '../../../shared/types-
|
|
2
|
+
import { I as IsolatedDeclarationsResult } from '../../../shared/types-BTXISiJt.js';
|
|
3
3
|
import '@rollup/plugin-alias';
|
|
4
4
|
import '@rollup/plugin-commonjs';
|
|
5
5
|
import '@rollup/plugin-json';
|
|
@@ -24,6 +24,4 @@ import '../../../shared/types-CzGE8V_d.js';
|
|
|
24
24
|
|
|
25
25
|
declare const isolatedDeclarationsTypescriptTransformer: (id: string, code: string, transformOptions?: TranspileOptions) => Promise<IsolatedDeclarationsResult>;
|
|
26
26
|
|
|
27
|
-
export { };
|
|
28
|
-
|
|
29
27
|
export = isolatedDeclarationsTypescriptTransformer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULTS as e}from"@rollup/plugin-node-resolve";const E=[...e.extensions,".cjs",".ts",".cts",".mts",".tsx",".jsx"],l={".aac":"file",".cjs":"js",".css":"file",".cts":"ts",".eot":"file",".flac":"file",".gif":"file",".jpeg":"file",".jpg":"file",".js":"js",".json":"json",".jsx":"jsx",".mjs":"js",".mp3":"file",".mp4":"file",".mts":"ts",".ogg":"file",".otf":"file",".png":"file",".svg":"file",".ts":"ts",".tsx":"tsx",".ttf":"file",".wav":"file",".webm":"file",".webp":"file",".woff":"file",".woff2":"file"},s="production",t="development",f=new Set(["react-server","react-native","edge-light"]),o=new Set([t,s,...f]),a=/node_modules/,N=/(?:\.d\.[mc]?ts|\.\w+)$/;export{
|
|
1
|
+
import{DEFAULTS as e}from"@rollup/plugin-node-resolve";const E=[...e.extensions,".cjs",".ts",".cts",".mts",".tsx",".jsx"],l={".aac":"file",".cjs":"js",".css":"file",".cts":"ts",".eot":"file",".flac":"file",".gif":"file",".jpeg":"file",".jpg":"file",".js":"js",".json":"json",".jsx":"jsx",".mjs":"js",".mp3":"file",".mp4":"file",".mts":"ts",".ogg":"file",".otf":"file",".png":"file",".svg":"file",".ts":"ts",".tsx":"tsx",".ttf":"file",".wav":"file",".webm":"file",".webp":"file",".woff":"file",".woff2":"file"},s="production",t="development",f=new Set(["react-server","react-native","edge-light"]),o=new Set([t,s,...f]),a=/node_modules/,N=/(?:\.d\.[mc]?ts|\.\w+)$/;export{E as D,N as E,s as P,f as R,o as S,t as a,a as b,l as c};
|
|
@@ -116,7 +116,7 @@ type BuildEntry = {
|
|
|
116
116
|
declaration?: boolean | "compatible" | "node16";
|
|
117
117
|
environment?: Environment;
|
|
118
118
|
esm?: boolean;
|
|
119
|
-
executable?:
|
|
119
|
+
executable?: true;
|
|
120
120
|
fileAlias?: string;
|
|
121
121
|
input: string;
|
|
122
122
|
isGlob?: boolean;
|
|
@@ -163,6 +163,7 @@ interface BuildHooks {
|
|
|
163
163
|
"rollup:dts:options": (context: BuildContext, options: RollupOptions) => Promise<void> | void;
|
|
164
164
|
"rollup:options": (context: BuildContext, options: RollupOptions) => Promise<void> | void;
|
|
165
165
|
"rollup:watch": (context: BuildContext, watcher: RollupWatcher) => Promise<void> | void;
|
|
166
|
+
"validate:before": (context: BuildContext) => Promise<void> | void;
|
|
166
167
|
"validate:done": (context: BuildContext) => Promise<void> | void;
|
|
167
168
|
}
|
|
168
169
|
type BuildContextBuildEntry = {
|
|
@@ -116,7 +116,7 @@ type BuildEntry = {
|
|
|
116
116
|
declaration?: boolean | "compatible" | "node16";
|
|
117
117
|
environment?: Environment;
|
|
118
118
|
esm?: boolean;
|
|
119
|
-
executable?:
|
|
119
|
+
executable?: true;
|
|
120
120
|
fileAlias?: string;
|
|
121
121
|
input: string;
|
|
122
122
|
isGlob?: boolean;
|
|
@@ -163,6 +163,7 @@ interface BuildHooks {
|
|
|
163
163
|
"rollup:dts:options": (context: BuildContext, options: RollupOptions) => Promise<void> | void;
|
|
164
164
|
"rollup:options": (context: BuildContext, options: RollupOptions) => Promise<void> | void;
|
|
165
165
|
"rollup:watch": (context: BuildContext, watcher: RollupWatcher) => Promise<void> | void;
|
|
166
|
+
"validate:before": (context: BuildContext) => Promise<void> | void;
|
|
166
167
|
"validate:done": (context: BuildContext) => Promise<void> | void;
|
|
167
168
|
}
|
|
168
169
|
type BuildContextBuildEntry = {
|
|
@@ -116,7 +116,7 @@ type BuildEntry = {
|
|
|
116
116
|
declaration?: boolean | "compatible" | "node16";
|
|
117
117
|
environment?: Environment;
|
|
118
118
|
esm?: boolean;
|
|
119
|
-
executable?:
|
|
119
|
+
executable?: true;
|
|
120
120
|
fileAlias?: string;
|
|
121
121
|
input: string;
|
|
122
122
|
isGlob?: boolean;
|
|
@@ -163,6 +163,7 @@ interface BuildHooks {
|
|
|
163
163
|
"rollup:dts:options": (context: BuildContext, options: RollupOptions) => Promise<void> | void;
|
|
164
164
|
"rollup:options": (context: BuildContext, options: RollupOptions) => Promise<void> | void;
|
|
165
165
|
"rollup:watch": (context: BuildContext, watcher: RollupWatcher) => Promise<void> | void;
|
|
166
|
+
"validate:before": (context: BuildContext) => Promise<void> | void;
|
|
166
167
|
"validate:done": (context: BuildContext) => Promise<void> | void;
|
|
167
168
|
}
|
|
168
169
|
type BuildContextBuildEntry = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/packem",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.96",
|
|
4
4
|
"description": "A fast and modern bundler for Node.js and TypeScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -33,9 +33,7 @@
|
|
|
33
33
|
"bunchee"
|
|
34
34
|
],
|
|
35
35
|
"homepage": "https://www.visulima.com/docs/package/packem",
|
|
36
|
-
"bugs":
|
|
37
|
-
"url": "https://github.com/visulima/packem/issues"
|
|
38
|
-
},
|
|
36
|
+
"bugs": "https://github.com/visulima/packem/issues",
|
|
39
37
|
"repository": {
|
|
40
38
|
"type": "git",
|
|
41
39
|
"url": "git+https://github.com/visulima/packem.git",
|
|
@@ -180,15 +178,15 @@
|
|
|
180
178
|
"@rollup/plugin-replace": "^5.0.7",
|
|
181
179
|
"@rollup/plugin-wasm": "^6.2.2",
|
|
182
180
|
"@rollup/pluginutils": "^5.1.0",
|
|
183
|
-
"@visulima/cerebro": "^1.1.
|
|
184
|
-
"@visulima/colorize": "^1.4.
|
|
185
|
-
"@visulima/find-cache-dir": "^1.0.
|
|
186
|
-
"@visulima/fs": "^2.1.
|
|
187
|
-
"@visulima/humanizer": "^1.0.
|
|
188
|
-
"@visulima/package": "^3.0.
|
|
189
|
-
"@visulima/pail": "^2.1.
|
|
190
|
-
"@visulima/path": "^1.0.
|
|
191
|
-
"@visulima/tsconfig": "^1.0.
|
|
181
|
+
"@visulima/cerebro": "^1.1.18",
|
|
182
|
+
"@visulima/colorize": "^1.4.8",
|
|
183
|
+
"@visulima/find-cache-dir": "^1.0.9",
|
|
184
|
+
"@visulima/fs": "^2.1.16",
|
|
185
|
+
"@visulima/humanizer": "^1.0.10",
|
|
186
|
+
"@visulima/package": "^3.0.10",
|
|
187
|
+
"@visulima/pail": "^2.1.7",
|
|
188
|
+
"@visulima/path": "^1.0.7",
|
|
189
|
+
"@visulima/tsconfig": "^1.0.11",
|
|
192
190
|
"defu": "6.1.4",
|
|
193
191
|
"es-module-lexer": "^1.5.4",
|
|
194
192
|
"fastest-levenshtein": "^1.0.16",
|
package/dist/cli.cjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";var w=Object.defineProperty;var d=(r,i)=>w(r,"name",{value:i,configurable:!0});const h=require("@visulima/cerebro"),b=require("@visulima/pail/reporter"),p=require("node:process"),l=require("./shared/constants-lwnJ_PjR.cjs"),E=require("./create-bundler.cjs"),v=require("@antfu/install-pkg"),o=require("@clack/prompts"),m=require("@visulima/fs"),D=require("@visulima/package/package-json"),u=require("@visulima/path"),j=d(r=>r&&typeof r=="object"&&"default"in r?r.default:r,"_interopDefaultCompat"),N=j(h),C="@visulima/packem",O="1.0.0-alpha.93";var V=Object.defineProperty,g=d((r,i)=>V(r,"name",{value:i,configurable:!0}),"a");const P=g(r=>{r.addCommand({description:"Demonstrate options required",execute:g(async({logger:i,options:e})=>{let s="build";e.watch?s="watch":e.jit&&(s="jit");const a={};let n;if(p.env.NODE_ENV&&[l.DEVELOPMENT_ENV,l.PRODUCTION_ENV].includes(p.env.NODE_ENV)&&(n=p.env.NODE_ENV),e.env)for(const t of e.env)if(t.key==="NODE_ENV"){if(n)throw new Error("NODE_ENV was already set, this can't be overridden.");n=t.value}else a["process.env."+t.key]=JSON.stringify(t.value);n===void 0&&(e.production?n=l.PRODUCTION_ENV:e.development&&(n=l.DEVELOPMENT_ENV));try{await E(e.dir,s,n,i,{cjsInterop:e.cjsInterop,clean:e.clean,configPath:e.config??void 0,debug:e.debug,minify:e.minify===void 0?n===l.PRODUCTION_ENV:e.minify,replace:{...a},rollup:{esbuild:{target:e.target},license:{path:e.license},metafile:e.metafile,...e.analyze?{visualizer:{}}:{visualizer:!1}},sourcemap:e.sourcemap,tsconfigPath:e.tsconfig??void 0})}catch(t){i.error(t),p.exit(1)}},"execute"),name:"build",options:[{defaultValue:".",description:"The directory to build",name:"dir",type:String},{alias:"t",description:"Environments to support. `target` in tsconfig.json is automatically added. Defaults to the current Node.js version.",name:"target"},{description:"Use a custom config file",name:"config",type:String},{description:"Path to the tsconfig.json file",name:"tsconfig",type:String},{description:"Minify the output",name:"minify",type:Boolean},{description:"Generate sourcemaps (experimental)",name:"sourcemap",type:Boolean},{conflicts:"jit",description:"Watch for changes",name:"watch",type:Boolean},{conflicts:"watch",description:"Stub the package for JIT compilation",name:"jit",type:Boolean},{description:"Compile-time environment variables (eg. --env.NODE_ENV=production)",multiple:!0,name:"env",type:g(i=>{const[e,s]=i.split("=");return{key:e,value:s}},"type")},{defaultValue:!1,description:"Generate meta file (experimental)",name:"metafile",type:Boolean},{description:"Path to the license file",name:"license",type:String},{conflicts:"watch",description:"Visualize and analyze the bundle",name:"analyze",type:Boolean},{description:"CJS interop mode, can export default and named export, (experimental).",name:"cjsInterop",type:Boolean},{conflicts:"development",description:"Run code in production environment",name:"production",type:Boolean},{conflicts:"production",description:"Run code in development environment",name:"development",type:Boolean},{description:"Do not clean the dist directory before building",name:"no-clean",type:Boolean}]})},"createBuildCommand");var T=Object.defineProperty,k=d((r,i)=>T(r,"name",{value:i,configurable:!0}),"m");const x=k(r=>{r.addCommand({description:"Initialize packem configuration",execute:k(async({logger:i,options:e})=>{if(o.intro("Welcome to packem setup"),m.isAccessibleSync(u.join(e.dir,"packem.config.ts"))){i.info("Packem project already initialized, you can use `packem build` to build your project");return}if(o.isCancel(e.transformer)){o.cancel("Operation cancelled");return}const s=u.join(e.dir,"package.json");if(!m.isAccessibleSync(s))throw new Error("No package.json found in the directory");const a=D.parsePackageJson(s),n=[];if(a.dependencies&&n.push(...Object.keys(a.dependencies)),a.devDependencies&&n.push(...Object.keys(a.devDependencies)),e.transformer===void 0&&(e.transformer=await o.select({message:"Pick a transformer",options:[{label:"esbuild",value:"esbuild"},{label:"swc",value:"swc"},{label:"Sucrase",value:"sucrase"}]}),!n.includes(e.transformer)&&await o.confirm({message:"Do you want to install "+e.transformer+"?"}))){const t=o.spinner();t.start("Installing "+e.transformer),await v.installPackage(e.transformer==="swc"?"@swc/core":e.transformer,{cwd:e.dir,dev:!0,silent:!0}),t.stop("")}if(e.isolatedDeclarationTransformer===void 0&&(e.isolatedDeclarationTransformer=await o.select({message:"Pick a isolated declaration transformer",options:[{label:"Typescript",value:"typescript"},{label:"swc",value:"swc"},{label:"OXC",value:"oxc"},{label:"None",value:null}]}),e.isolatedDeclarationTransformer!==null)){let t;switch(e.isolatedDeclarationTransformer){case"typescript":{t="typescript";break}case"swc":{t="@swc/core";break}case"oxc":{t="oxc-transform";break}default:o.cancel("Invalid isolated declaration transformer")}if(t&&!n.includes(t)&&await o.confirm({message:"Do you want to install "+t+"?"})){const c=o.spinner();c.start("Installing "+e.isolatedDeclarationTransformer),await v.installPackage(t,{cwd:e.dir,dev:!0,silent:!0}),c.stop("")}}if(n.includes("typescript")||a.type==="module"){const t=`import { defineConfig } from "@visulima/packem/config";
|
|
3
|
-
import transformer from "@visulima/packem/transformer/${e.transformer}";
|
|
4
|
-
${e.isolatedDeclarationTransformer===null?"":`import isolatedDeclarationTransformer from "@visulima/packem/dts/isolated/transformer/${e.isolatedDeclarationTransformer}";
|
|
5
|
-
`}
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
transformer${e.isolatedDeclarationTransformer===null?"":`,
|
|
8
|
-
isolatedDeclarationTransformer`}
|
|
9
|
-
});
|
|
10
|
-
`,c=o.spinner(),f=a.type==="module"?"mjs":"ts";c.start("Creating packem.config."+f),m.writeFileSync(u.join(e.dir,"packem.config."+f),t),c.stop("Created packem.config."+f)}else{const t=`const { defineConfig } = require("@visulima/packem/config");
|
|
11
|
-
const transformer = require("@visulima/packem/transformer/${e.transformer}");
|
|
12
|
-
|
|
13
|
-
module.exports = defineConfig({
|
|
14
|
-
transformer
|
|
15
|
-
});
|
|
16
|
-
`,c=o.spinner();c.start("Creating packem.config.js"),m.writeFileSync(u.join(e.dir,"packem.config.js"),t),c.stop("Created packem.config.js")}o.outro("Now you can run `packem build` to build your project")},"execute"),name:"init",options:[{defaultValue:".",description:"The directory to initialize",name:"dir",type:String},{description:"Choose a transformer",name:"transformer",type:String},{description:"Choose a isolated declaration transformer",name:"isolated-declaration-transformer",type:String}]})},"createInitCommand"),y=new N("packem",{logger:{reporters:[new b.SimpleReporter({error:{hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0}})],scope:"packem"},packageName:C,packageVersion:O});x(y);P(y);y.run({shouldExitProcess:!1});
|