@visulima/packem 1.0.0-alpha.46 → 1.0.0-alpha.48
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 +12 -0
- package/dist/cli.cjs +2 -2
- package/dist/cli.mjs +3 -3
- package/dist/create-bundler.cjs +2 -1
- package/dist/create-bundler.mjs +2 -1
- package/package.json +17 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## @visulima/packem [1.0.0-alpha.48](https://github.com/visulima/packem/compare/@visulima/packem@1.0.0-alpha.47...@visulima/packem@1.0.0-alpha.48) (2024-07-09)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* improved error display ([c5815be](https://github.com/visulima/packem/commit/c5815be6af64b8be517e43fed498c0d1c7d8a79d))
|
|
6
|
+
|
|
7
|
+
## @visulima/packem [1.0.0-alpha.47](https://github.com/visulima/packem/compare/@visulima/packem@1.0.0-alpha.46...@visulima/packem@1.0.0-alpha.47) (2024-07-09)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* updated dep of packem ([5cb9cd5](https://github.com/visulima/packem/commit/5cb9cd52a1dc3619caa1cf58dba0aa86604ed1f4))
|
|
12
|
+
|
|
1
13
|
## @visulima/packem [1.0.0-alpha.46](https://github.com/visulima/packem/compare/@visulima/packem@1.0.0-alpha.45...@visulima/packem@1.0.0-alpha.46) (2024-06-26)
|
|
2
14
|
|
|
3
15
|
### Features
|
package/dist/cli.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var y=Object.defineProperty;var s=(t,n)=>y(t,"name",{value:n,configurable:!0});const v=require("@visulima/cerebro"),k=require("@visulima/pail/reporter"),b=require("./create-bundler.cjs"),
|
|
2
|
+
"use strict";var y=Object.defineProperty;var s=(t,n)=>y(t,"name",{value:n,configurable:!0});const v=require("@visulima/cerebro"),k=require("@visulima/pail/reporter"),h=require("node:process"),b=require("./create-bundler.cjs"),j=require("@antfu/install-pkg"),i=require("@clack/prompts"),c=require("@visulima/fs"),w=require("@visulima/package/package-json"),l=require("@visulima/path"),C=s(t=>t&&typeof t=="object"&&"default"in t?t.default:t,"_interopDefaultCompat"),S=C(v),x="@visulima/packem",P="1.0.0-alpha.47";var q=Object.defineProperty,p=s((t,n)=>q(t,"name",{value:n,configurable:!0}),"a");const z=p(t=>{t.addCommand({description:"Demonstrate options required",execute:p(async({logger:n,options:e})=>{let o="build";e.watch?o="watch":e.jit&&(o="jit");const r={};if(e.env)for(const a of e.env)r[a.key]=a.value;try{await b(e.dir,o,n,{cjsInterop:e.cjsInterop,configPath:e.config??void 0,debug:e.debug,minify:e.minify,replace:{...r},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(a){n.error(a),h.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:p(n=>{const[e,o]=n.split("=");return{key:e,value:o}},"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}]})},"createBuildCommand");var B=Object.defineProperty,f=s((t,n)=>B(t,"name",{value:n,configurable:!0}),"t");const I=f(t=>{t.addCommand({description:"Initialize packem configuration",execute:f(async({logger:n,options:e})=>{if(i.intro("Welcome to packem setup"),c.isAccessibleSync(l.join(e.dir,"packem.config.ts"))){n.info("Packem project already initialized, you can use `packem build` to build your project");return}if(i.isCancel(e.transformer)){i.cancel("Operation cancelled");return}if(e.transformer===void 0){const a=l.join(e.dir,"package.json");if(!c.isAccessibleSync(a))throw new Error("No package.json found in the directory");const u=w.parsePackageJson(a),g=[...Object.keys(u.dependencies??{}),...Object.keys(u.devDependencies??{})];if(e.transformer=await i.select({message:"Pick a transformer",options:[{label:"esbuild",value:"esbuild"},{label:"swc",value:"swc"},{label:"Sucrase",value:"sucrase"}]}),!g.includes(e.transformer)&&await i.confirm({message:"Do you want to install "+e.transformer+"?"})){const d=i.spinner();d.start("Installing "+e.transformer),await j.installPackage(e.transformer==="swc"?"@swc/core":e.transformer,{cwd:e.dir,dev:!0,silent:!0}),d.stop("")}}const o=`import { defineConfig } from "@visulima/packem/config";
|
|
3
3
|
import transformer from "@visulima/packem/transformer/${e.transformer}";
|
|
4
4
|
|
|
5
5
|
export default defineConfig({
|
|
6
6
|
transformer
|
|
7
7
|
});
|
|
8
|
-
`,
|
|
8
|
+
`,r=i.spinner();r.start("Creating packem.config.ts"),c.writeFileSync(l.join(e.dir,"packem.config.ts"),o),r.stop("Created packem.config.ts"),i.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 to use for packem",name:"transformer",type:String}]})},"createInitCommand"),m=new S("packem",{logger:{reporters:[new k.SimpleReporter],scope:"packem"},packageName:x,packageVersion:P});I(m);z(m);m.run({shouldExitProcess:!1});
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var y=Object.defineProperty;var r=(
|
|
2
|
+
var y=Object.defineProperty;var r=(o,t)=>y(o,"name",{value:t,configurable:!0});import v from"@visulima/cerebro";import{SimpleReporter as k}from"@visulima/pail/reporter";import{exit as h}from"node:process";import b from"./create-bundler.mjs";import{installPackage as w}from"@antfu/install-pkg";import{intro as j,isCancel as x,cancel as C,select as S,confirm as P,spinner as d,outro as z}from"@clack/prompts";import{isAccessibleSync as f,writeFileSync as B}from"@visulima/fs";import{parsePackageJson as I}from"@visulima/package/package-json";import{join as c}from"@visulima/path";
|
|
3
3
|
// -- pack CommonJS Shims --
|
|
4
4
|
import __cjs_url__ from "node:url";
|
|
5
5
|
import __cjs_path__ from "node:path";
|
|
@@ -7,10 +7,10 @@ import __cjs_mod__ from "node:module";
|
|
|
7
7
|
const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
8
8
|
const __dirname = __cjs_path__.dirname(__filename);
|
|
9
9
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
10
|
-
const
|
|
10
|
+
const N="@visulima/packem",O="1.0.0-alpha.47";var V=Object.defineProperty,s=r((o,t)=>V(o,"name",{value:t,configurable:!0}),"a");const D=s(o=>{o.addCommand({description:"Demonstrate options required",execute:s(async({logger:t,options:e})=>{let i="build";e.watch?i="watch":e.jit&&(i="jit");const a={};if(e.env)for(const n of e.env)a[n.key]=n.value;try{await b(e.dir,i,t,{cjsInterop:e.cjsInterop,configPath:e.config??void 0,debug:e.debug,minify: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(n){t.error(n),h(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:s(t=>{const[e,i]=t.split("=");return{key:e,value:i}},"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}]})},"createBuildCommand");var E=Object.defineProperty,u=r((o,t)=>E(o,"name",{value:t,configurable:!0}),"t");const J=u(o=>{o.addCommand({description:"Initialize packem configuration",execute:u(async({logger:t,options:e})=>{if(j("Welcome to packem setup"),f(c(e.dir,"packem.config.ts"))){t.info("Packem project already initialized, you can use `packem build` to build your project");return}if(x(e.transformer)){C("Operation cancelled");return}if(e.transformer===void 0){const n=c(e.dir,"package.json");if(!f(n))throw new Error("No package.json found in the directory");const p=I(n),g=[...Object.keys(p.dependencies??{}),...Object.keys(p.devDependencies??{})];if(e.transformer=await S({message:"Pick a transformer",options:[{label:"esbuild",value:"esbuild"},{label:"swc",value:"swc"},{label:"Sucrase",value:"sucrase"}]}),!g.includes(e.transformer)&&await P({message:"Do you want to install "+e.transformer+"?"})){const l=d();l.start("Installing "+e.transformer),await w(e.transformer==="swc"?"@swc/core":e.transformer,{cwd:e.dir,dev:!0,silent:!0}),l.stop("")}}const i=`import { defineConfig } from "@visulima/packem/config";
|
|
11
11
|
import transformer from "@visulima/packem/transformer/${e.transformer}";
|
|
12
12
|
|
|
13
13
|
export default defineConfig({
|
|
14
14
|
transformer
|
|
15
15
|
});
|
|
16
|
-
`,
|
|
16
|
+
`,a=d();a.start("Creating packem.config.ts"),B(c(e.dir,"packem.config.ts"),i),a.stop("Created packem.config.ts"),z("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 to use for packem",name:"transformer",type:String}]})},"createInitCommand"),m=new v("packem",{logger:{reporters:[new k],scope:"packem"},packageName:N,packageVersion:O});J(m);D(m);m.run({shouldExitProcess:!1});
|
package/dist/create-bundler.cjs
CHANGED
|
@@ -96,4 +96,5 @@ ${s.chunks.map(l=>{const c=t.buildEntries.find(p=>p.path===l)??{};return g.gray(
|
|
|
96
96
|
${g.bold("Entries:")}
|
|
97
97
|
${v.options.entries.map(M=>` ${et(M)}`).join(`
|
|
98
98
|
`)}`),await fr(v),v.options.stub){await Ut(v),await v.hooks.callHook("build:done",v);return}if(t==="watch"){if(v.options.rollup.watch===!1)throw new Error("Rollup watch is disabled. You should check your packem.config file.");await Ln(v,w),ot(v,!1);return}await gr(v,c,w),o.raw(`
|
|
99
|
-
⚡️ Build run in `+j()),o.restoreAll()}catch(u){throw
|
|
99
|
+
⚡️ Build run in `+j()),o.restoreAll()}catch(u){throw o.raw(`
|
|
100
|
+
`),Qe(u),new Error("An error occurred while building",{cause:u})}},"createBundler");module.exports=hr;
|
package/dist/create-bundler.mjs
CHANGED
|
@@ -104,4 +104,5 @@ ${s.chunks.map(l=>{const c=t.buildEntries.find(p=>p.path===l)??{};return M("
|
|
|
104
104
|
${O("Entries:")}
|
|
105
105
|
${h.options.entries.map(R=>` ${ft(R)}`).join(`
|
|
106
106
|
`)}`),await Wn(h),h.options.stub){await yo(h),await h.hooks.callHook("build:done",h);return}if(t==="watch"){if(h.options.rollup.watch===!1)throw new Error("Rollup watch is disabled. You should check your packem.config file.");await dn(h,j),ht(h,!1);return}await Bn(h,c,j),o.raw(`
|
|
107
|
-
⚡️ Build run in `+w()),o.restoreAll()}catch(u){throw
|
|
107
|
+
⚡️ Build run in `+w()),o.restoreAll()}catch(u){throw o.raw(`
|
|
108
|
+
`),dt(u),new Error("An error occurred while building",{cause:u})}},"createBundler");export{Es 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.48",
|
|
4
4
|
"description": "A fast and modern bundler for Node.js and TypeScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -123,15 +123,15 @@
|
|
|
123
123
|
"@rollup/plugin-replace": "^5.0.7",
|
|
124
124
|
"@rollup/plugin-wasm": "^6.2.2",
|
|
125
125
|
"@rollup/pluginutils": "^5.1.0",
|
|
126
|
-
"@visulima/cerebro": "^1.1.
|
|
126
|
+
"@visulima/cerebro": "^1.1.8",
|
|
127
127
|
"@visulima/colorize": "^1.4.3",
|
|
128
|
-
"@visulima/
|
|
128
|
+
"@visulima/find-cache-dir": "^1.0.3",
|
|
129
|
+
"@visulima/fs": "^2.1.10",
|
|
129
130
|
"@visulima/humanizer": "^1.0.5",
|
|
130
|
-
"@visulima/package": "^3.0.
|
|
131
|
-
"@visulima/
|
|
132
|
-
"@visulima/pail": "^1.4.3",
|
|
131
|
+
"@visulima/package": "^3.0.4",
|
|
132
|
+
"@visulima/pail": "^2.0.0",
|
|
133
133
|
"@visulima/path": "^1.0.2",
|
|
134
|
-
"@visulima/tsconfig": "^1.0.
|
|
134
|
+
"@visulima/tsconfig": "^1.0.4",
|
|
135
135
|
"defu": "6.1.4",
|
|
136
136
|
"es-module-lexer": "^1.5.4",
|
|
137
137
|
"fastest-levenshtein": "^1.0.16",
|
|
@@ -140,9 +140,9 @@
|
|
|
140
140
|
"hookable": "^5.5.3",
|
|
141
141
|
"magic-string": "^0.30.10",
|
|
142
142
|
"mlly": "^1.7.1",
|
|
143
|
-
"rollup": "^4.18.
|
|
143
|
+
"rollup": "^4.18.1",
|
|
144
144
|
"rollup-plugin-dts": "^6.1.1",
|
|
145
|
-
"rollup-plugin-license": "^3.5.
|
|
145
|
+
"rollup-plugin-license": "^3.5.2",
|
|
146
146
|
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
147
147
|
"rollup-plugin-visualizer": "^5.12.0",
|
|
148
148
|
"semver": "^7.6.2"
|
|
@@ -155,28 +155,27 @@
|
|
|
155
155
|
"@babel/core": "^7.24.7",
|
|
156
156
|
"@rushstack/eslint-plugin-security": "^0.8.1",
|
|
157
157
|
"@secretlint/secretlint-rule-preset-recommend": "^8.2.4",
|
|
158
|
-
"@swc/core": "^1.6.
|
|
158
|
+
"@swc/core": "^1.6.13",
|
|
159
159
|
"@swc/types": "0.1.9",
|
|
160
160
|
"@total-typescript/ts-reset": "^0.5.1",
|
|
161
161
|
"@types/estree": "^1.0.5",
|
|
162
162
|
"@types/glob": "^8.1.0",
|
|
163
163
|
"@types/glob-parent": "^5.1.3",
|
|
164
|
-
"@types/micromatch": "^4.0.7",
|
|
165
164
|
"@types/node": "18.19.39",
|
|
166
165
|
"@types/react": "^18.3.3",
|
|
167
166
|
"@types/react-dom": "^18.3.0",
|
|
168
167
|
"@types/semver": "^7.5.8",
|
|
169
|
-
"@vitest/coverage-v8": "^
|
|
170
|
-
"@vitest/ui": "^
|
|
168
|
+
"@vitest/coverage-v8": "^2.0.1",
|
|
169
|
+
"@vitest/ui": "^2.0.1",
|
|
171
170
|
"conventional-changelog-conventionalcommits": "8.0.0",
|
|
172
171
|
"cross-env": "^7.0.3",
|
|
173
|
-
"esbuild": "^0.
|
|
174
|
-
"eslint": "
|
|
172
|
+
"esbuild": "^0.23.0",
|
|
173
|
+
"eslint": "8.57.0",
|
|
175
174
|
"eslint-plugin-deprecation": "^3.0.0",
|
|
176
175
|
"eslint-plugin-etc": "^2.0.3",
|
|
177
176
|
"eslint-plugin-import": "npm:eslint-plugin-i@^2.29.1",
|
|
178
177
|
"eslint-plugin-mdx": "^3.1.5",
|
|
179
|
-
"eslint-plugin-vitest": "
|
|
178
|
+
"eslint-plugin-vitest": "0.4.1",
|
|
180
179
|
"eslint-plugin-vitest-globals": "^1.5.0",
|
|
181
180
|
"estree-walker": "^3.0.3",
|
|
182
181
|
"execa": "^9.3.0",
|
|
@@ -191,8 +190,8 @@
|
|
|
191
190
|
"sucrase": "^3.35.0",
|
|
192
191
|
"tempy": "^3.1.0",
|
|
193
192
|
"ts-essentials": "^10.0.1",
|
|
194
|
-
"typescript": "^5.5.
|
|
195
|
-
"vitest": "^
|
|
193
|
+
"typescript": "^5.5.3",
|
|
194
|
+
"vitest": "^2.0.1"
|
|
196
195
|
},
|
|
197
196
|
"peerDependencies": {
|
|
198
197
|
"@swc/core": "^1.5.7",
|