@visulima/packem 1.0.0-alpha.93 → 1.0.0-alpha.94
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
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## @visulima/packem [1.0.0-alpha.94](https://github.com/visulima/packem/compare/@visulima/packem@1.0.0-alpha.93...@visulima/packem@1.0.0-alpha.94) (2024-09-07)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* fixed interface change ([7b427f7](https://github.com/visulima/packem/commit/7b427f7fb98e590f79894dc42c65502e1cdedac6))
|
|
6
|
+
* update dependencies, added attw lint, add pkg preview ([703d97e](https://github.com/visulima/packem/commit/703d97e9a9d1fc00558c73cfb3a479a424405261))
|
|
7
|
+
|
|
1
8
|
## @visulima/packem [1.0.0-alpha.93](https://github.com/visulima/packem/compare/@visulima/packem@1.0.0-alpha.92...@visulima/packem@1.0.0-alpha.93) (2024-09-06)
|
|
2
9
|
|
|
3
10
|
### Features
|
package/dist/cli.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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.
|
|
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
3
|
import transformer from "@visulima/packem/transformer/${e.transformer}";
|
|
4
4
|
${e.isolatedDeclarationTransformer===null?"":`import isolatedDeclarationTransformer from "@visulima/packem/dts/isolated/transformer/${e.isolatedDeclarationTransformer}";
|
|
5
5
|
`}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
var j=Object.defineProperty;var p=(a,t)=>j(a,"name",{value:t,configurable:!0});import C from"@visulima/cerebro";import{SimpleReporter as N}from"@visulima/pail/reporter";import{env as d,exit as V}from"node:process";import{b as y,P as f}from"./shared/constants-DcRh98q_.mjs";import x from"./create-bundler.mjs";import{installPackage as v}from"@antfu/install-pkg";import{intro as O,isCancel as T,cancel as k,select as w,confirm as h,spinner as c,outro as P}from"@clack/prompts";import{isAccessibleSync as b,writeFileSync as D}from"@visulima/fs";import{parsePackageJson as S}from"@visulima/package/package-json";import{join as l}from"@visulima/path";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
3
3
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
4
|
-
const B="@visulima/packem",I="1.0.0-alpha.
|
|
4
|
+
const B="@visulima/packem",I="1.0.0-alpha.93";var z=Object.defineProperty,u=p((a,t)=>z(a,"name",{value:t,configurable:!0}),"a");const _=u(a=>{a.addCommand({description:"Demonstrate options required",execute:u(async({logger:t,options:e})=>{let n="build";e.watch?n="watch":e.jit&&(n="jit");const i={};let o;if(d.NODE_ENV&&[y,f].includes(d.NODE_ENV)&&(o=d.NODE_ENV),e.env)for(const r of e.env)if(r.key==="NODE_ENV"){if(o)throw new Error("NODE_ENV was already set, this can't be overridden.");o=r.value}else i["process.env."+r.key]=JSON.stringify(r.value);o===void 0&&(e.production?o=f:e.development&&(o=y));try{await x(e.dir,n,o,t,{cjsInterop:e.cjsInterop,clean:e.clean,configPath:e.config??void 0,debug:e.debug,minify:e.minify===void 0?o===f:e.minify,replace:{...i},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(r){t.error(r),V(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:u(t=>{const[e,n]=t.split("=");return{key:e,value:n}},"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 $=Object.defineProperty,E=p((a,t)=>$(a,"name",{value:t,configurable:!0}),"m");const J=E(a=>{a.addCommand({description:"Initialize packem configuration",execute:E(async({logger:t,options:e})=>{if(O("Welcome to packem setup"),b(l(e.dir,"packem.config.ts"))){t.info("Packem project already initialized, you can use `packem build` to build your project");return}if(T(e.transformer)){k("Operation cancelled");return}const n=l(e.dir,"package.json");if(!b(n))throw new Error("No package.json found in the directory");const i=S(n),o=[];if(i.dependencies&&o.push(...Object.keys(i.dependencies)),i.devDependencies&&o.push(...Object.keys(i.devDependencies)),e.transformer===void 0&&(e.transformer=await w({message:"Pick a transformer",options:[{label:"esbuild",value:"esbuild"},{label:"swc",value:"swc"},{label:"Sucrase",value:"sucrase"}]}),!o.includes(e.transformer)&&await h({message:"Do you want to install "+e.transformer+"?"}))){const r=c();r.start("Installing "+e.transformer),await v(e.transformer==="swc"?"@swc/core":e.transformer,{cwd:e.dir,dev:!0,silent:!0}),r.stop("")}if(e.isolatedDeclarationTransformer===void 0&&(e.isolatedDeclarationTransformer=await w({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 r;switch(e.isolatedDeclarationTransformer){case"typescript":{r="typescript";break}case"swc":{r="@swc/core";break}case"oxc":{r="oxc-transform";break}default:k("Invalid isolated declaration transformer")}if(r&&!o.includes(r)&&await h({message:"Do you want to install "+r+"?"})){const s=c();s.start("Installing "+e.isolatedDeclarationTransformer),await v(r,{cwd:e.dir,dev:!0,silent:!0}),s.stop("")}}if(o.includes("typescript")||i.type==="module"){const r=`import { defineConfig } from "@visulima/packem/config";
|
|
5
5
|
import transformer from "@visulima/packem/transformer/${e.transformer}";
|
|
6
6
|
${e.isolatedDeclarationTransformer===null?"":`import isolatedDeclarationTransformer from "@visulima/packem/dts/isolated/transformer/${e.isolatedDeclarationTransformer}";
|
|
7
7
|
`}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var t=Object.defineProperty;var s=(r,e)=>t(r,"name",{value:e,configurable:!0});const a=require("oxc-transform");var c=Object.defineProperty,n=s((r,e)=>c(r,"name",{value:e,configurable:!0}),"o");const i=n((r,e)=>{const o=a.isolatedDeclaration(r,e,{sourcemap:!1});return{errors:o.errors,sourceText:o.code}},"isolatedDeclarationsOxcTransformer");module.exports=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var t=Object.defineProperty;var a=(r,e)=>t(r,"name",{value:e,configurable:!0});import{isolatedDeclaration as s}from"oxc-transform";var c=Object.defineProperty,n=a((r,e)=>c(r,"name",{value:e,configurable:!0}),"o");const u=n((r,e)=>{const o=s(r,e,{sourcemap:!1});return{errors:o.errors,sourceText:o.code}},"isolatedDeclarationsOxcTransformer");export{u as default};
|
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.94",
|
|
4
4
|
"description": "A fast and modern bundler for Node.js and TypeScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -180,15 +180,15 @@
|
|
|
180
180
|
"@rollup/plugin-replace": "^5.0.7",
|
|
181
181
|
"@rollup/plugin-wasm": "^6.2.2",
|
|
182
182
|
"@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.
|
|
183
|
+
"@visulima/cerebro": "^1.1.17",
|
|
184
|
+
"@visulima/colorize": "^1.4.7",
|
|
185
|
+
"@visulima/find-cache-dir": "^1.0.8",
|
|
186
|
+
"@visulima/fs": "^2.1.15",
|
|
187
|
+
"@visulima/humanizer": "^1.0.9",
|
|
188
|
+
"@visulima/package": "^3.0.9",
|
|
189
|
+
"@visulima/pail": "^2.1.6",
|
|
190
|
+
"@visulima/path": "^1.0.6",
|
|
191
|
+
"@visulima/tsconfig": "^1.0.10",
|
|
192
192
|
"defu": "6.1.4",
|
|
193
193
|
"es-module-lexer": "^1.5.4",
|
|
194
194
|
"fastest-levenshtein": "^1.0.16",
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
"is-glob": "^4.0.3",
|
|
198
198
|
"magic-string": "^0.30.11",
|
|
199
199
|
"mlly": "^1.7.1",
|
|
200
|
-
"oxc-parser": "^0.
|
|
200
|
+
"oxc-parser": "^0.27.0",
|
|
201
201
|
"rollup": "^4.21.2",
|
|
202
202
|
"rollup-plugin-dts": "^6.1.1",
|
|
203
203
|
"rollup-plugin-license": "^3.5.2",
|
|
@@ -211,13 +211,13 @@
|
|
|
211
211
|
"@anolilab/prettier-config": "^5.0.14",
|
|
212
212
|
"@anolilab/semantic-release-pnpm": "^1.1.3",
|
|
213
213
|
"@anolilab/semantic-release-preset": "^9.0.0",
|
|
214
|
-
"@arethetypeswrong/cli": "^0.
|
|
214
|
+
"@arethetypeswrong/cli": "^0.16.1",
|
|
215
215
|
"@babel/core": "^7.25.2",
|
|
216
216
|
"@rushstack/eslint-plugin-security": "^0.8.2",
|
|
217
217
|
"@secretlint/secretlint-rule-preset-recommend": "^8.2.4",
|
|
218
|
-
"@swc/core": "^1.7.
|
|
218
|
+
"@swc/core": "^1.7.23",
|
|
219
219
|
"@swc/types": "0.1.12",
|
|
220
|
-
"@total-typescript/ts-reset": "^0.6.
|
|
220
|
+
"@total-typescript/ts-reset": "^0.6.1",
|
|
221
221
|
"@types/estree": "^1.0.5",
|
|
222
222
|
"@types/glob": "^8.1.0",
|
|
223
223
|
"@types/glob-parent": "^5.1.3",
|
|
@@ -242,7 +242,7 @@
|
|
|
242
242
|
"estree-walker": "^3.0.3",
|
|
243
243
|
"execa": "^9.3.1",
|
|
244
244
|
"jiti": "^1.21.6",
|
|
245
|
-
"oxc-transform": "^0.
|
|
245
|
+
"oxc-transform": "^0.27.0",
|
|
246
246
|
"prettier": "^3.3.3",
|
|
247
247
|
"react": "^18.3.1",
|
|
248
248
|
"react-dom": "^18.3.1",
|
|
@@ -312,6 +312,7 @@
|
|
|
312
312
|
"build:prod": "cross-env JITI_ESM_RESOLVE=1 INTERNAL_PACKEM_BUILD=1 jiti ./src/cli build --production",
|
|
313
313
|
"clean": "rimraf node_modules dist .eslintcache",
|
|
314
314
|
"dev": "pnpm run build",
|
|
315
|
+
"lint:attw": "attw --pack",
|
|
315
316
|
"lint:eslint": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs",
|
|
316
317
|
"lint:eslint:fix": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs --fix",
|
|
317
318
|
"lint:fix": "pnpm run lint:prettier:fix && pnpm run lint:eslint:fix",
|