@funish/basis 0.2.8-edge.0 → 0.2.8-edge.1
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/dist/_chunks/config-lvw40IpZ.mjs +1 -0
- package/dist/_chunks/fmt-9Yi9STzz.mjs +1 -0
- package/dist/_chunks/lint-3A6_NhRY.mjs +1 -0
- package/dist/_chunks/run-D8ZiNeaU.mjs +1 -0
- package/dist/_chunks/{types-DVbgCQzS.d.mts → types-C-71QzwD.d.mts} +6 -5
- package/dist/cli/basis.mjs +9 -9
- package/dist/cli/oxfmt.mjs +1 -1
- package/dist/cli/oxlint.mjs +1 -1
- package/dist/config.d.mts +6 -104
- package/dist/config.mjs +1 -1
- package/dist/index.d.mts +1 -2
- package/package.json +2 -2
- package/dist/_chunks/config-Coiy-SOC.mjs +0 -1
- package/dist/_chunks/fmt-C7X2ZSv6.mjs +0 -1
- package/dist/_chunks/jiti-vEYKRgRF.mjs +0 -1
- package/dist/_chunks/json5-ChGBk47n.mjs +0 -1
- package/dist/_chunks/jsonc-Bxv8GEpJ.mjs +0 -1
- package/dist/_chunks/lint-ESN87Ohj.mjs +0 -1
- package/dist/_chunks/ohash-B0rolVSO.mjs +0 -1
- package/dist/_chunks/prompt-B-_yUJXC.mjs +0 -1
- package/dist/_chunks/rolldown-runtime-coR7_hWt.mjs +0 -1
- package/dist/_chunks/run-CYtHqbev.mjs +0 -1
- package/dist/_chunks/toml-DAGiUu8W.mjs +0 -1
- package/dist/_chunks/vendor/common-C57wNPL5.d.mts +0 -7226
- package/dist/_chunks/vendor/common-DNe_sHJp.mjs +0 -352
- package/dist/_chunks/yaml-Dm3OG7zi.mjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{loadConfig as e}from"c12";import{findWorkspaceDir as t}from"pkg-types";import{dirname as n}from"pathe";import{defineBuildConfig as r}from"@funish/build/config";function i(e){return e}async function a(r={}){if(r.cwd)return await e({name:`basis`,cwd:r.cwd,...r,defaults:{...r.defaults}});let i=process.cwd(),a=await t(i);for(;;){let t=await e({name:`basis`,cwd:i,...r,defaults:{...r.defaults}});if(t._configFile||i===a)return t;i=n(i)}}export{r as n,a as r,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./config-lvw40IpZ.mjs";import{t}from"./run-D8ZiNeaU.mjs";import{defineCommand as n}from"citty";import{consola as r}from"consola";const i=n({meta:{name:`fmt`,description:`Format code`},async run({rawArgs:n}){let{config:i}=await e(),a=i.fmt?.config||[];t({pkg:`oxfmt`,bin:`cli.js`,args:n.length>0?n:a}).status!==0&&process.exit(1),r.success(`Formatting completed`)}});export{i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./config-lvw40IpZ.mjs";import{t}from"./run-D8ZiNeaU.mjs";import{defineCommand as n}from"citty";import{consola as r}from"consola";const i=n({meta:{name:`lint`,description:`Lint code`},async run({rawArgs:n}){let{config:i}=await e(),a=i.lint?.config||[];t({pkg:`oxlint`,bin:`cli.js`,args:n.length>0?n:a}).status!==0&&process.exit(1),r.success(`Linting completed`)}});export{i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as e}from"node:module";import{dirname as t,resolve as n}from"pathe";import{consola as r}from"consola";import{spawnSync as i}from"node:child_process";function a(a){let{pkg:o,bin:s,args:c}=a,l=n(t(e(import.meta.url).resolve(o)),s),u=i(process.execPath,[l,...c],{stdio:`inherit`,shell:!1});return u.error&&r.error(u.error),u.status!==0&&r.error(`${o} failed with exit code ${u.status}`),u}export{a as t};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GitConfig } from "pkg-types";
|
|
2
|
+
import { JitiOptions } from "jiti";
|
|
2
3
|
|
|
3
4
|
//#region src/types.d.ts
|
|
4
5
|
interface BasisConfig {
|
|
@@ -6,7 +7,7 @@ interface BasisConfig {
|
|
|
6
7
|
extends?: string | string[];
|
|
7
8
|
lint?: LintConfig;
|
|
8
9
|
fmt?: FmtConfig;
|
|
9
|
-
git?: GitConfig;
|
|
10
|
+
git?: GitConfig$1;
|
|
10
11
|
run?: RunConfig;
|
|
11
12
|
audit?: AuditConfig;
|
|
12
13
|
version?: VersionConfig;
|
|
@@ -36,11 +37,11 @@ interface StagedConfig {
|
|
|
36
37
|
/**
|
|
37
38
|
* Git command configuration
|
|
38
39
|
*/
|
|
39
|
-
interface GitConfig {
|
|
40
|
+
interface GitConfig$1 {
|
|
40
41
|
/** Git hooks */
|
|
41
42
|
hooks?: Partial<Record<ValidGitHook, string>>;
|
|
42
43
|
/** Git configuration */
|
|
43
|
-
config?: GitConfig
|
|
44
|
+
config?: GitConfig;
|
|
44
45
|
/** Commit message validation */
|
|
45
46
|
commitMsg?: CommitMsgConfig;
|
|
46
47
|
/** Staged files check */
|
|
@@ -192,4 +193,4 @@ interface PublishOptions {
|
|
|
192
193
|
otp?: string;
|
|
193
194
|
}
|
|
194
195
|
//#endregion
|
|
195
|
-
export { FmtConfig as a, LintConfig as c, RunConfig as d, StagedConfig as f, VersionOptions as g, VersionConfig as h, CommitMsgConfig as i, PublishConfig as l, ValidGitHook as m, BasisConfig as n, GitConfig as o, VALID_GIT_HOOKS as p, CommitMessage as r, InitOptions as s, AuditConfig as t, PublishOptions as u };
|
|
196
|
+
export { FmtConfig as a, LintConfig as c, RunConfig as d, StagedConfig as f, VersionOptions as g, VersionConfig as h, CommitMsgConfig as i, PublishConfig as l, ValidGitHook as m, BasisConfig as n, GitConfig$1 as o, VALID_GIT_HOOKS as p, CommitMessage as r, InitOptions as s, AuditConfig as t, PublishOptions as u };
|
package/dist/cli/basis.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{r as e}from"../_chunks/
|
|
2
|
+
import{r as e}from"../_chunks/config-lvw40IpZ.mjs";import"../_chunks/run-D8ZiNeaU.mjs";import{t}from"../_chunks/lint-3A6_NhRY.mjs";import{t as n}from"../_chunks/fmt-9Yi9STzz.mjs";import{loadConfig as r}from"c12";import{readPackageJSON as i,resolvePackageJSON as a,writePackageJSON as o}from"pkg-types";import{resolve as s}from"pathe";import{defineCommand as c,runMain as l}from"citty";import{consola as u}from"consola";import{readFile as d,stat as f,writeFile as p}from"node:fs/promises";import{exec as m,setupEnvironment as h}from"dugite";import{addDependency as g,addDevDependency as _,detectPackageManager as v,dlx as y,removeDependency as b,runScript as x}from"nypm";import{execSync as S,spawnSync as C}from"node:child_process";import{build as w}from"@funish/build";import T from"picomatch";import{createJiti as ee}from"jiti";import{existsSync as E}from"node:fs";import D from"semver";import{glob as O}from"tinyglobby";async function k(e=process.cwd(),t={}){let{force:n=!1,skipGitCheck:i=!1}=t;u.start(`Initializing basis configuration`);let a=(await r({cwd:e,name:`basis`}))._configFile;if(a&&!n)return u.error(`Configuration file already exists: ${a}`),u.info(`Use --force to overwrite.`),!1;let o=(await v(e))?.name||`npm`,s=o===`npm`?`npx`:o,c={git:{hooks:{"pre-commit":`${s} basis git staged`,"commit-msg":`${s} basis git lint-commit`},staged:{rules:{"**/*.{ts,tsx,js,jsx}":`basis lint`,"**/*.{json,md,yml,yaml}":`basis fmt`}}}},l=`import { defineBasisConfig } from "@funish/basis/config";
|
|
3
3
|
|
|
4
|
-
export default defineBasisConfig(${JSON.stringify(
|
|
5
|
-
`,
|
|
6
|
-
`).filter(Boolean),n=await(
|
|
7
|
-
`).filter(Boolean));return t.filter(e=>!r.has(e))}catch{return[]}}async function
|
|
8
|
-
`).filter(Boolean).forEach(e=>{let t=e.match(/^(..)\s+(.+)$/);if(!t)return;let[,
|
|
9
|
-
`).filter(Boolean).forEach(e=>{let t=e.match(/^(..)\s+(.+)$/);if(!t)return;let[,
|
|
10
|
-
`)[0],n=t.match(/^(\w+)(\(([^)]+)\))?(!)?:\s*(.+)$/);if(!n)return null;let[,r,,i,,a]=n;return{type:r,scope:i,subject:a,isBreaking:t.includes(`!`)||e.includes(`BREAKING CHANGE:`)}}async function
|
|
11
|
-
`)[0];return p.length>i&&d.push(`Header too long (${p.length} chars). Max: ${i}`),p.length<a&&d.push(`Header too short (${p.length} chars). Min: ${a}`),o&&!f.scope&&d.push(`Scope is required`),f.scope&&s.length>0&&!s.includes(f.scope)&&d.push(`Invalid scope '${f.scope}'. Allowed: ${s.join(`, `)}`),d.length>0?(l.error(`Invalid commit message:`),d.forEach(e=>l.error(` ${e}`)),!1):(l.success(`Commit message validation passed`),!0)}async function B(e=process.cwd()){let{config:t}=await b(),n=t.git?.hooks;if(!n||Object.keys(n).length===0)return l.warn(`No Git hooks configured`),!0;let r=u(e,`.git/hooks`);try{for(let[e,t]of Object.entries(n))await T(u(r,e),`#!/bin/sh\n${t}\n`,{mode:493}),l.success(`Created ${e} hook`);return!0}catch(e){return l.error(`Failed to setup Git hooks:`,e),!1}}async function V(e=process.cwd()){return l.start(`Setting up Git configuration`),await B(e)?(l.success(`Git setup completed`),!0):!1}const H=c({meta:{name:`git`,description:`Git operations`},async run({rawArgs:e}){let t=e[0];if(!t){l.info(`Available subcommands: staged, lint-commit, setup`),l.info(`Git passthrough mode: basis git <git-command>`);return}switch(t){case`staged`:await I()||process.exit(1);return;case`lint-commit`:await z()||process.exit(1);return;case`setup`:await V()||process.exit(1);return;default:try{let t=await(0,O.exec)(e,process.cwd(),{processCallback:e=>{e.stdout?.on(`data`,e=>{process.stdout.write(e)}),e.stderr?.on(`data`,e=>{process.stderr.write(e)})}});if(t.exitCode!==0)throw Error(`git exited with code ${t.exitCode}`)}catch(e){l.error(`Git operation failed:`,e),process.exit(1)}}}}),U=c({meta:{name:`run`,description:`Run scripts or files`},async run({rawArgs:e}){e.length===0&&(l.error(`Please specify a script name or file path`),process.exit(1));let[t,...n]=e,r=process.cwd(),{config:i}=await b(),a=i.run?.config,o=u(r,t);if(C(o))try{let t=_(r,a),n=t.esmResolve(o);process.argv=[process.argv[0],n,...e.slice(1)],await t.import(n);return}catch(e){l.error(`Failed to run file:`),l.error(` ${String(e)}`),process.exit(1)}try{await m(t,{cwd:r,args:n})}catch(e){l.error(`Failed to run script "${t}":`),l.error(` ${String(e)}`),process.exit(1)}}});var W=e(p());function G(e,t,n){if(t.version){if(W.default.valid(t.version))return t.version;throw Error(`Invalid version format: ${t.version}. Please use semantic versioning format (e.g., 1.0.0, 2.1.0-alpha.1)`)}if(!W.default.valid(e))throw Error(`Invalid current version format: ${e}. Please fix version in package.json to use semantic versioning format (e.g., 1.0.0)`);let r=W.default.prerelease(e),i=t.preid||(r&&typeof r[0]==`string`?r[0]:null)||n.preid||`edge`,a=`patch`;t.major?a=`major`:t.minor?a=`minor`:t.premajor?a=`premajor`:t.preminor?a=`preminor`:t.prepatch?a=`prepatch`:t.prerelease?a=r?`prerelease`:`prepatch`:t.fromGit&&(a=`patch`);let o=a===`prerelease`||a.startsWith(`pre`)?W.default.inc(e,a,i):W.default.inc(e,a);if(!o)throw Error(`Failed to calculate new version from ${e}. Please check your version increment options.`);return o}const K=c({meta:{name:`version`,description:`Update package version`},args:{version:{type:`positional`,description:`Version to set (patch, minor, major, prerelease, or specific version)`,required:!1},preid:{type:`string`,description:`Prerelease identifier (alpha, beta, rc)`},major:{type:`boolean`,description:`Bump major version`},minor:{type:`boolean`,description:`Bump minor version`},patch:{type:`boolean`,description:`Bump patch version`},premajor:{type:`boolean`,description:`Bump premajor version`},preminor:{type:`boolean`,description:`Bump preminor version`},prepatch:{type:`boolean`,description:`Bump prepatch version`},prerelease:{type:`boolean`,description:`Bump prerelease version`},"allow-same-version":{type:`boolean`,description:`Allow same version`}},async run({args:e}){try{let{config:r}=await b(),i={preid:e.preid,major:e.major,minor:e.minor,patch:e.patch||!e.major&&!e.minor&&!e.version,premajor:e.premajor,preminor:e.preminor,prepatch:e.prepatch,prerelease:e.prerelease,allowSameVersion:e[`allow-same-version`]};if(e.version){let t=e.version;[`patch`,`minor`,`major`,`prerelease`,`premajor`,`preminor`,`prepatch`].includes(t)?i[t]=!0:i.version=t}let a=process.cwd(),o=await v(a),s=o.version;if(!s)throw Error(`No version found in package.json`);let c=G(s,i,r.version||{});if(!i.allowSameVersion&&c===s)throw Error(`Version unchanged: ${s}. Use --allow-same-version to allow this.`);await t(await n(a),{...o,version:c}),l.success(`Version updated: ${s} → ${c}`)}catch(e){l.error(`Version update failed:`,e),process.exit(1)}}});async function q(e,t){let n=process.cwd(),r=await v(n),i=r.version,a=r.name;if(!a)throw Error(`Package name is required in package.json`);if(!i)throw Error(`Package version is required in package.json`);let o=(await g(n))?.name||`npm`,s={tag:`latest`,access:`public`,...t.npm},c=e.tag;if(!c&&i&&i.includes(`-`)){let e=i.match(/-(\w+)\.\d+$/);e&&(c=e[1])}c=c||s.tag||`latest`;let u=D(o,[`publish`,...(t=>{let n=[];e.tarball&&n.push(e.tarball),n.push(`--tag`,t);let r=e.access||s.access;return r&&n.push(`--access`,r),e.dryRun&&n.push(`--dry-run`),e.otp&&n.push(`--otp`,e.otp),n})(c)],{stdio:`inherit`,shell:!0});if(u.status!==0){l.error(`Publish failed with exit code ${u.status}`);return}let d=s.additionalTag;if(!e.dryRun&&d&&d!==c){let e=D(`npm`,[`dist-tag`,`add`,`${a}@${i}`,d],{cwd:n,stdio:`inherit`,shell:!0});if(e.status!==0){l.error(`Failed to add dist-tag with exit code ${e.status}`);return}}else d&&l.info(`Skipping dist-tag ${d} (same as publish tag ${c})`)}async function J(e,t){let n=process.cwd(),r=t?.tagPrefix;if(!r)throw Error(`Git tagPrefix is required`);let i=`${r}${e}`,a=t?.message?t.message(e):`chore: release ${i}`;await(0,O.exec)([`add`,`package.json`],n),await(0,O.exec)([`commit`,`-m`,a],n),await(0,O.exec)([`tag`,i,...t?.signTag?[`--sign`]:[]],n),t?.push&&(await(0,O.exec)([`push`],n),await(0,O.exec)([`push`,`--tags`],n))}const Y=c({meta:{name:`publish`,description:`Publish to registry`},args:{tag:{type:`string`,description:`Publish tag`},git:{type:`boolean`,description:`Also create git tag and commit`},access:{type:`string`,description:`Package access level (public, restricted)`},"dry-run":{type:`boolean`,description:`Dry run mode`},otp:{type:`string`,description:`One-time password for 2FA`}},async run({args:e}){try{let{config:t}=await b();if(await q({tag:e.tag,git:e.git,access:e.access||void 0,dryRun:e[`dry-run`],otp:e.otp},t.publish||{}),l.success(`Package published successfully`),e.git&&t.publish?.git){l.info(`Creating git tag and commit...`);let e=(await v(process.cwd())).version;e&&(await J(e,t.publish.git),l.success(`Git operations completed`))}}catch(e){l.error(`Publish failed:`,e),process.exit(1)}}}),X={npm:{outdated:[`outdated`],audit:[`audit`]},yarn:{outdated:[`outdated`,`-c`],audit:[`audit`]},pnpm:{outdated:[`outdated`],audit:[`audit`]},bun:{outdated:[`outdated`],audit:[`audit`]},deno:{outdated:null,audit:null}};async function Z(e=process.cwd(),t,r=!1){let{config:i}=await b({overrides:t?{audit:{dependencies:t}}:void 0}),a=i.audit?.dependencies||{};l.start(`Auditing dependencies...`);let o=!1;if(a.blocked&&a.blocked.length>0)try{let t=await v(e),n={...t.dependencies,...t.devDependencies},r=Object.keys(n).filter(e=>a.blocked?.includes(e));r.length>0&&(l.error(`Found ${r.length} blocked package(s): ${r.join(`, `)}`),o=!0)}catch(e){l.error(`Failed to check blocked packages:`,e),o=!0}if(a.outdated)try{let t=(await g(e))?.name||`npm`,n=X[t];n.outdated?D(t,n.outdated,{cwd:e,stdio:`inherit`,shell:!0}).status!==0&&l.warn(`Some dependencies are outdated`):l.info(`Skipping outdated check for ${t}`)}catch(e){l.error(`Failed to check outdated dependencies:`,e),o=!0}if(a.security)try{let t=(await g(e))?.name||`npm`,n=X[t];n.audit?D(t,n.audit,{cwd:e,stdio:`inherit`,shell:!0}).status!==0&&(o=!0):l.info(`Skipping security audit for ${t}`)}catch(e){l.error(`Failed to check security vulnerabilities:`,e),o=!0}if(a.licenses&&(a.licenses.allowed||a.licenses.blocked))try{let t=await n(e),r=await ne(e),i=[];for(let e of r)try{let n=await v(e);if(!n.name||e===t)continue;if(n.license){let e=Array.isArray(n.license)?n.license.join(`, `):n.license;if(a.licenses.blocked&&a.licenses.blocked.some(t=>e.includes(t))){i.push(`${n.name}: ${e}`);continue}a.licenses.allowed&&a.licenses.allowed.length>0&&(a.licenses.allowed.some(t=>e.includes(t))||i.push(`${n.name}: ${e}`))}}catch{}i.length>0&&(l.error(`Packages with invalid licenses:`),i.forEach(e=>l.error(` ${e}`)),o=!0)}catch(e){l.error(`Failed to check licenses:`,e),o=!0}return o||l.success(`Dependencies audit passed`),!o}async function ne(e){try{return await i([`node_modules/*/package.json`,`node_modules/@*/*/package.json`,`node_modules/@*/*/*/package.json`],{cwd:e,absolute:!0})}catch{return[]}}async function Q(e=process.cwd(),t){let{config:n}=await b({overrides:t?{audit:{structure:t}}:void 0}),r=n.audit?.structure||{};l.start(`Auditing project structure...`);let a=!1;if(r.required&&r.required.length>0){let t=[];for(let n of r.required)try{await ee(u(e,n))}catch{n.includes(`*`)||n.includes(`?`)?(await i([n],{cwd:e})).length===0&&t.push(n):t.push(n)}t.length>0&&(l.error(`Missing required file(s)/director(ies): ${t.join(`, `)}`),a=!0)}if(r.files&&r.files.length>0)for(let t of r.files)try{let n=await i([t.pattern],{cwd:e}),r=new RegExp(t.rule),o=n.filter(e=>!r.test(e));o.length>0&&(l.error(`${t.message}: ${o.slice(0,5).join(`, `)}${o.length>5?`...`:``}`),a=!0)}catch(e){l.error(`Failed to check file naming rule: ${t.pattern}`,e),a=!0}if(r.dirs&&r.dirs.length>0)for(let t of r.dirs)try{let n=await i([t.pattern],{cwd:e}),r=new RegExp(t.rule),o=n.filter(e=>!r.test(e));o.length>0&&(l.error(`${t.message}: ${o.slice(0,5).join(`, `)}${o.length>5?`...`:``}`),a=!0)}catch(e){l.error(`Failed to check directory naming rule: ${t.pattern}`,e),a=!0}return a||l.success(`Structure audit passed`),!a}async function re(e=process.cwd(),t=!1){let{config:n}=await b(),r=n.audit||{};l.start(`Running comprehensive project audit...`);let i=(await Promise.allSettled([Z(e,r.dependencies,t),Q(e,r.structure)])).filter(e=>e.status===`rejected`||e.status===`fulfilled`&&!e.value);return i.length===0?(l.success(`All audits passed`),!0):(l.error(`${i.length} audit(s) failed`),!1)}const ie=c({meta:{name:`audit`,description:`Audit code quality`},args:{dependencies:{type:`boolean`,description:`Dependencies audit`},structure:{type:`boolean`,description:`Project structure audit`},fix:{type:`boolean`,description:`Auto-fix issues`}},async run({args:e}){let t=process.cwd(),n=!0;if(!e.dependencies&&!e.structure)n=await re(t,e.fix);else{let r=[];e.dependencies&&r.push(()=>Z(t,void 0,e.fix)),e.structure&&r.push(()=>Q(t));for(let e of r)await e()||(n=!1)}n||(l.error(`Some audits failed`),process.exit(1))}}),ae=c({meta:{name:`add`,description:`Add dependencies`},args:{dev:{type:`boolean`,description:`Add as dev dependency`,alias:`D`}},async run({args:e,rawArgs:t}){t.length===0&&(l.error(`Please specify at least one package name`),l.info(`Example: basis add lodash`),process.exit(1));let n=t.filter(e=>!e.startsWith(`-`));n.length===0&&(l.error(`Please specify at least one package name`),process.exit(1));try{e.dev?(await d(n,{cwd:process.cwd()}),l.success(`Added ${n.join(`, `)} as dev dependencies`)):(await a(n,{cwd:process.cwd()}),l.success(`Added ${n.join(`, `)} as dependencies`))}catch(e){l.error(`Add packages failed:`,e),process.exit(1)}}}),oe=c({meta:{name:`remove`,description:`Remove dependencies`},async run({rawArgs:e}){e.length===0&&(l.error(`Please specify at least one package name`),l.info(`Example: basis remove lodash`),process.exit(1));let t=e.filter(e=>!e.startsWith(`-`));t.length===0&&(l.error(`Please specify at least one package name`),process.exit(1));try{await s(t,{cwd:process.cwd()}),l.success(`Removed ${t.join(`, `)}`)}catch(e){l.error(`Remove packages failed:`,e),process.exit(1)}}}),se=c({meta:{name:`dlx`,description:`Execute package without installation`},async run({rawArgs:e}){try{e.length===0&&(l.error(`Please specify a package to run`),process.exit(1));let[t,...n]=e;await o(t,{args:n,cwd:process.cwd()}),l.success(`Dlx completed`)}catch(e){l.error(`Dlx failed:`,e),process.exit(1)}}}),$=await v(import.meta.url);r(c({meta:{name:`basis`,description:$.description,version:$.version},subCommands:{init:k,lint:x,fmt:S,build:M,git:H,run:U,version:K,publish:Y,audit:ie,add:ae,remove:oe,dlx:se}}));export{};
|
|
4
|
+
export default defineBasisConfig(${JSON.stringify(c,null,2)});
|
|
5
|
+
`,d=`${e}/basis.config.ts`;if(await p(d,l,`utf8`),u.success(`Configuration created in ${d}`),!i)try{await m([`--version`],e),u.info(`Git detected`)}catch{u.info(`Git not found`)}return u.success(`Basis initialization completed!`),u.info(`Run 'basis git setup' to setup Git hooks`),!0}const A=c({meta:{name:`init`,description:`Initialize configuration`},args:{force:{type:`boolean`,description:`Overwrite existing configuration`},"skip-git-check":{type:`boolean`,description:`Skip git directory check`},"skip-install":{type:`boolean`,description:`Skip dependency installation`}},async run({args:e}){try{await k(process.cwd(),{force:e.force,skipGitCheck:e[`skip-git-check`],skipInstall:e[`skip-install`]})}catch(e){u.error(`Init failed:`,e),process.exit(1)}}}),j=c({meta:{name:`build`,description:`Build project`},args:{dir:{type:`string`,description:`Project directory`,default:`.`},stub:{type:`boolean`,description:`Generate stub files`,default:!1}},async run({args:e}){let t=s(e.dir||`.`);try{let{config:n={}}=await r({name:`isbuild`,configFile:`build.config`,cwd:t}),i=(n.entries||[]).map(t=>{if(typeof t==`string`){let[n,r]=t.split(`:`);return n.endsWith(`/`)?{type:`transform`,input:n,outDir:r,stub:e.stub}:{type:`bundle`,input:n.split(`,`),outDir:r,stub:e.stub}}return{...t,stub:e.stub}});(!i||i.length===0)&&(u.error(`No build entries specified in build.config.`),process.exit(1)),await w({cwd:t,...n,entries:i}),u.success(`Build completed`)}catch(e){u.error(`Build failed:`,e),process.exit(1)}}});async function M(){try{let e=S(`git --exec-path`,{encoding:`utf8`}).trim();if(e){let t=h({LOCAL_GIT_DIRECTORY:s(e,`..`,`..`,`..`)});Object.assign(process.env,t.env),u.debug(`Using system Git from: ${t.gitLocation}`)}}catch{u.debug(`System Git not found, dugite will use embedded Git`)}}M();async function N(e){try{let t=(await m([`diff`,`--cached`,`--name-only`],e)).stdout.trim().split(`
|
|
6
|
+
`).filter(Boolean),n=await m([`diff`,`--cached`,`--name-only`,`--diff-filter=D`],e),r=new Set(n.stdout.trim().split(`
|
|
7
|
+
`).filter(Boolean));return t.filter(e=>!r.has(e))}catch{return[]}}async function P(t=process.cwd()){let{config:n}=await e(),r=n.git?.staged?.rules||{};if(Object.keys(r).length===0)return u.warn(`No staged rules configured. Add git.staged.rules to your basis.config.ts`),!0;let i=await N(t);if(i.length===0)return u.info(`No staged files to check`),!0;u.start(`Checking ${i.length} staged file(s)`);let a=!1,o=new Set;for(let[e,n]of Object.entries(r)){let r=T(e),s=i.filter(e=>!o.has(e)&&r(e));if(s.length!==0){u.info(`Running ${n} for ${s.length} file(s) matching ${e}`);try{let e=await m([`status`,`--porcelain`],t),r=new Set;e.stdout.trim().split(`
|
|
8
|
+
`).filter(Boolean).forEach(e=>{let t=e.match(/^(..)\s+(.+)$/);if(!t)return;let[,n,i]=t;(n[1]===`M`||n===` M`)&&r.add(i)}),S(n,{cwd:t,stdio:`inherit`});let i=await m([`status`,`--porcelain`],t),a=new Set;i.stdout.trim().split(`
|
|
9
|
+
`).filter(Boolean).forEach(e=>{let t=e.match(/^(..)\s+(.+)$/);if(!t)return;let[,n,i]=t;(n[1]===`M`||n===` M`)&&(s.includes(i)?a.add(i):r.has(i)||a.add(i))}),a.size>0&&(await m([`add`,...Array.from(a)],t),u.info(`Re-staged ${a.size} file(s) after formatting`)),s.forEach(e=>o.add(e))}catch(t){a=!0,u.error(`Staged check failed for pattern '${e}':`,t)}}}return a?(u.error(`Some staged files checks failed`),!1):(u.success(`Staged files check passed`),!0)}const F=[`feat`,`fix`,`docs`,`style`,`refactor`,`perf`,`test`,`build`,`ci`,`chore`,`revert`];function I(e){let t=e.trim().split(`
|
|
10
|
+
`)[0],n=t.match(/^(\w+)(\(([^)]+)\))?(!)?:\s*(.+)$/);if(!n)return null;let[,r,,i,,a]=n;return{type:r,scope:i,subject:a,isBreaking:t.includes(`!`)||e.includes(`BREAKING CHANGE:`)}}async function L(t=process.cwd()){let{config:n}=await e(),r=n.git?.commitMsg,i=r?.types||F,a=r?.maxLength||72,o=r?.minLength||10,c=r?.scopeRequired||!1,l=r?.allowedScopes||[],f;try{let e=s(t,`.git/COMMIT_EDITMSG`);try{f=(await d(e)).toString(`utf8`)}catch{f=(await m([`log`,`-1`,`--pretty=%B`],t)).stdout.trim()}}catch(e){return u.error(`Failed to read commit message:`,e),!1}let p=[],h=I(f);if(!h)return u.error(`Invalid commit format. Expected: type(scope): subject`),!1;i.includes(h.type)||p.push(`Invalid type '${h.type}'. Allowed: ${i.join(`, `)}`);let g=f.split(`
|
|
11
|
+
`)[0];return g.length>a&&p.push(`Header too long (${g.length} chars). Max: ${a}`),g.length<o&&p.push(`Header too short (${g.length} chars). Min: ${o}`),c&&!h.scope&&p.push(`Scope is required`),h.scope&&l.length>0&&!l.includes(h.scope)&&p.push(`Invalid scope '${h.scope}'. Allowed: ${l.join(`, `)}`),p.length>0?(u.error(`Invalid commit message:`),p.forEach(e=>u.error(` ${e}`)),!1):(u.success(`Commit message validation passed`),!0)}async function R(t=process.cwd()){let{config:n}=await e(),r=n.git?.hooks;if(!r||Object.keys(r).length===0)return u.warn(`No Git hooks configured`),!0;let i=s(t,`.git/hooks`);try{for(let[e,t]of Object.entries(r))await p(s(i,e),`#!/bin/sh\n${t}\n`,{mode:493}),u.success(`Created ${e} hook`);return!0}catch(e){return u.error(`Failed to setup Git hooks:`,e),!1}}async function z(e=process.cwd()){return u.start(`Setting up Git configuration`),await R(e)?(u.success(`Git setup completed`),!0):!1}const B=c({meta:{name:`git`,description:`Git operations`},async run({rawArgs:e}){let t=e[0];if(!t){u.info(`Available subcommands: staged, lint-commit, setup`),u.info(`Git passthrough mode: basis git <git-command>`);return}switch(t){case`staged`:await P()||process.exit(1);return;case`lint-commit`:await L()||process.exit(1);return;case`setup`:await z()||process.exit(1);return;default:try{let t=await m(e,process.cwd(),{processCallback:e=>{e.stdout?.on(`data`,e=>{process.stdout.write(e)}),e.stderr?.on(`data`,e=>{process.stderr.write(e)})}});if(t.exitCode!==0)throw Error(`git exited with code ${t.exitCode}`)}catch(e){u.error(`Git operation failed:`,e),process.exit(1)}}}}),V=c({meta:{name:`run`,description:`Run scripts or files`},async run({rawArgs:t}){t.length===0&&(u.error(`Please specify a script name or file path`),process.exit(1));let[n,...r]=t,i=process.cwd(),{config:a}=await e(),o=a.run?.config,c=s(i,n);if(E(c))try{let e=ee(i,o),n=e.esmResolve(c);process.argv=[process.argv[0],n,...t.slice(1)],await e.import(n);return}catch(e){u.error(`Failed to run file:`),u.error(` ${String(e)}`),process.exit(1)}try{await x(n,{cwd:i,args:r})}catch(e){u.error(`Failed to run script "${n}":`),u.error(` ${String(e)}`),process.exit(1)}}});function H(e,t,n){if(t.version){if(D.valid(t.version))return t.version;throw Error(`Invalid version format: ${t.version}. Please use semantic versioning format (e.g., 1.0.0, 2.1.0-alpha.1)`)}if(!D.valid(e))throw Error(`Invalid current version format: ${e}. Please fix version in package.json to use semantic versioning format (e.g., 1.0.0)`);let r=D.prerelease(e),i=t.preid||(r&&typeof r[0]==`string`?r[0]:null)||n.preid||`edge`,a=`patch`;t.major?a=`major`:t.minor?a=`minor`:t.premajor?a=`premajor`:t.preminor?a=`preminor`:t.prepatch?a=`prepatch`:t.prerelease?a=r?`prerelease`:`prepatch`:t.fromGit&&(a=`patch`);let o=a===`prerelease`||a.startsWith(`pre`)?D.inc(e,a,i):D.inc(e,a);if(!o)throw Error(`Failed to calculate new version from ${e}. Please check your version increment options.`);return o}const U=c({meta:{name:`version`,description:`Update package version`},args:{version:{type:`positional`,description:`Version to set (patch, minor, major, prerelease, or specific version)`,required:!1},preid:{type:`string`,description:`Prerelease identifier (alpha, beta, rc)`},major:{type:`boolean`,description:`Bump major version`},minor:{type:`boolean`,description:`Bump minor version`},patch:{type:`boolean`,description:`Bump patch version`},premajor:{type:`boolean`,description:`Bump premajor version`},preminor:{type:`boolean`,description:`Bump preminor version`},prepatch:{type:`boolean`,description:`Bump prepatch version`},prerelease:{type:`boolean`,description:`Bump prerelease version`},"allow-same-version":{type:`boolean`,description:`Allow same version`}},async run({args:t}){try{let{config:n}=await e(),r={preid:t.preid,major:t.major,minor:t.minor,patch:t.patch||!t.major&&!t.minor&&!t.version,premajor:t.premajor,preminor:t.preminor,prepatch:t.prepatch,prerelease:t.prerelease,allowSameVersion:t[`allow-same-version`]};if(t.version){let e=t.version;[`patch`,`minor`,`major`,`prerelease`,`premajor`,`preminor`,`prepatch`].includes(e)?r[e]=!0:r.version=e}let s=process.cwd(),c=await i(s),l=c.version;if(!l)throw Error(`No version found in package.json`);let d=H(l,r,n.version||{});if(!r.allowSameVersion&&d===l)throw Error(`Version unchanged: ${l}. Use --allow-same-version to allow this.`);await o(await a(s),{...c,version:d}),u.success(`Version updated: ${l} → ${d}`)}catch(e){u.error(`Version update failed:`,e),process.exit(1)}}});async function W(e,t){let n=process.cwd(),r=await i(n),a=r.version,o=r.name;if(!o)throw Error(`Package name is required in package.json`);if(!a)throw Error(`Package version is required in package.json`);let s=(await v(n))?.name||`npm`,c={tag:`latest`,access:`public`,...t.npm},l=e.tag;if(!l&&a&&a.includes(`-`)){let e=a.match(/-(\w+)\.\d+$/);e&&(l=e[1])}l=l||c.tag||`latest`;let d=C(s,[`publish`,...(t=>{let n=[];e.tarball&&n.push(e.tarball),n.push(`--tag`,t);let r=e.access||c.access;return r&&n.push(`--access`,r),e.dryRun&&n.push(`--dry-run`),e.otp&&n.push(`--otp`,e.otp),n})(l)],{stdio:`inherit`,shell:!0});if(d.status!==0){u.error(`Publish failed with exit code ${d.status}`);return}let f=c.additionalTag;if(!e.dryRun&&f&&f!==l){let e=C(`npm`,[`dist-tag`,`add`,`${o}@${a}`,f],{cwd:n,stdio:`inherit`,shell:!0});if(e.status!==0){u.error(`Failed to add dist-tag with exit code ${e.status}`);return}}else f&&u.info(`Skipping dist-tag ${f} (same as publish tag ${l})`)}async function G(e,t){let n=process.cwd(),r=t?.tagPrefix;if(!r)throw Error(`Git tagPrefix is required`);let i=`${r}${e}`,a=t?.message?t.message(e):`chore: release ${i}`;await m([`add`,`package.json`],n),await m([`commit`,`-m`,a],n),await m([`tag`,i,...t?.signTag?[`--sign`]:[]],n),t?.push&&(await m([`push`],n),await m([`push`,`--tags`],n))}const K=c({meta:{name:`publish`,description:`Publish to registry`},args:{tag:{type:`string`,description:`Publish tag`},git:{type:`boolean`,description:`Also create git tag and commit`},access:{type:`string`,description:`Package access level (public, restricted)`},"dry-run":{type:`boolean`,description:`Dry run mode`},otp:{type:`string`,description:`One-time password for 2FA`}},async run({args:t}){try{let{config:n}=await e();if(await W({tag:t.tag,git:t.git,access:t.access||void 0,dryRun:t[`dry-run`],otp:t.otp},n.publish||{}),u.success(`Package published successfully`),t.git&&n.publish?.git){u.info(`Creating git tag and commit...`);let e=(await i(process.cwd())).version;e&&(await G(e,n.publish.git),u.success(`Git operations completed`))}}catch(e){u.error(`Publish failed:`,e),process.exit(1)}}}),q={npm:{outdated:[`outdated`],audit:[`audit`]},yarn:{outdated:[`outdated`,`-c`],audit:[`audit`]},pnpm:{outdated:[`outdated`],audit:[`audit`]},bun:{outdated:[`outdated`],audit:[`audit`]},deno:{outdated:null,audit:null}};async function J(t=process.cwd(),n,r=!1){let{config:o}=await e({overrides:n?{audit:{dependencies:n}}:void 0}),s=o.audit?.dependencies||{};u.start(`Auditing dependencies...`);let c=!1;if(s.blocked&&s.blocked.length>0)try{let e=await i(t),n={...e.dependencies,...e.devDependencies},r=Object.keys(n).filter(e=>s.blocked?.includes(e));r.length>0&&(u.error(`Found ${r.length} blocked package(s): ${r.join(`, `)}`),c=!0)}catch(e){u.error(`Failed to check blocked packages:`,e),c=!0}if(s.outdated)try{let e=(await v(t))?.name||`npm`,n=q[e];n.outdated?C(e,n.outdated,{cwd:t,stdio:`inherit`,shell:!0}).status!==0&&u.warn(`Some dependencies are outdated`):u.info(`Skipping outdated check for ${e}`)}catch(e){u.error(`Failed to check outdated dependencies:`,e),c=!0}if(s.security)try{let e=(await v(t))?.name||`npm`,n=q[e];n.audit?C(e,n.audit,{cwd:t,stdio:`inherit`,shell:!0}).status!==0&&(c=!0):u.info(`Skipping security audit for ${e}`)}catch(e){u.error(`Failed to check security vulnerabilities:`,e),c=!0}if(s.licenses&&(s.licenses.allowed||s.licenses.blocked))try{let e=await a(t),n=await Y(t),r=[];for(let t of n)try{let n=await i(t);if(!n.name||t===e)continue;if(n.license){let e=Array.isArray(n.license)?n.license.join(`, `):n.license;if(s.licenses.blocked&&s.licenses.blocked.some(t=>e.includes(t))){r.push(`${n.name}: ${e}`);continue}s.licenses.allowed&&s.licenses.allowed.length>0&&(s.licenses.allowed.some(t=>e.includes(t))||r.push(`${n.name}: ${e}`))}}catch{}r.length>0&&(u.error(`Packages with invalid licenses:`),r.forEach(e=>u.error(` ${e}`)),c=!0)}catch(e){u.error(`Failed to check licenses:`,e),c=!0}return c||u.success(`Dependencies audit passed`),!c}async function Y(e){try{return await O([`node_modules/*/package.json`,`node_modules/@*/*/package.json`,`node_modules/@*/*/*/package.json`],{cwd:e,absolute:!0})}catch{return[]}}async function X(t=process.cwd(),n){let{config:r}=await e({overrides:n?{audit:{structure:n}}:void 0}),i=r.audit?.structure||{};u.start(`Auditing project structure...`);let a=!1;if(i.required&&i.required.length>0){let e=[];for(let n of i.required)try{await f(s(t,n))}catch{n.includes(`*`)||n.includes(`?`)?(await O([n],{cwd:t})).length===0&&e.push(n):e.push(n)}e.length>0&&(u.error(`Missing required file(s)/director(ies): ${e.join(`, `)}`),a=!0)}if(i.files&&i.files.length>0)for(let e of i.files)try{let n=await O([e.pattern],{cwd:t}),r=new RegExp(e.rule),i=n.filter(e=>!r.test(e));i.length>0&&(u.error(`${e.message}: ${i.slice(0,5).join(`, `)}${i.length>5?`...`:``}`),a=!0)}catch(t){u.error(`Failed to check file naming rule: ${e.pattern}`,t),a=!0}if(i.dirs&&i.dirs.length>0)for(let e of i.dirs)try{let n=await O([e.pattern],{cwd:t}),r=new RegExp(e.rule),i=n.filter(e=>!r.test(e));i.length>0&&(u.error(`${e.message}: ${i.slice(0,5).join(`, `)}${i.length>5?`...`:``}`),a=!0)}catch(t){u.error(`Failed to check directory naming rule: ${e.pattern}`,t),a=!0}return a||u.success(`Structure audit passed`),!a}async function Z(t=process.cwd(),n=!1){let{config:r}=await e(),i=r.audit||{};u.start(`Running comprehensive project audit...`);let a=(await Promise.allSettled([J(t,i.dependencies,n),X(t,i.structure)])).filter(e=>e.status===`rejected`||e.status===`fulfilled`&&!e.value);return a.length===0?(u.success(`All audits passed`),!0):(u.error(`${a.length} audit(s) failed`),!1)}const Q=c({meta:{name:`audit`,description:`Audit code quality`},args:{dependencies:{type:`boolean`,description:`Dependencies audit`},structure:{type:`boolean`,description:`Project structure audit`},fix:{type:`boolean`,description:`Auto-fix issues`}},async run({args:e}){let t=process.cwd(),n=!0;if(!e.dependencies&&!e.structure)n=await Z(t,e.fix);else{let r=[];e.dependencies&&r.push(()=>J(t,void 0,e.fix)),e.structure&&r.push(()=>X(t));for(let e of r)await e()||(n=!1)}n||(u.error(`Some audits failed`),process.exit(1))}}),te=c({meta:{name:`add`,description:`Add dependencies`},args:{dev:{type:`boolean`,description:`Add as dev dependency`,alias:`D`}},async run({args:e,rawArgs:t}){t.length===0&&(u.error(`Please specify at least one package name`),u.info(`Example: basis add lodash`),process.exit(1));let n=t.filter(e=>!e.startsWith(`-`));n.length===0&&(u.error(`Please specify at least one package name`),process.exit(1));try{e.dev?(await _(n,{cwd:process.cwd()}),u.success(`Added ${n.join(`, `)} as dev dependencies`)):(await g(n,{cwd:process.cwd()}),u.success(`Added ${n.join(`, `)} as dependencies`))}catch(e){u.error(`Add packages failed:`,e),process.exit(1)}}}),ne=c({meta:{name:`remove`,description:`Remove dependencies`},async run({rawArgs:e}){e.length===0&&(u.error(`Please specify at least one package name`),u.info(`Example: basis remove lodash`),process.exit(1));let t=e.filter(e=>!e.startsWith(`-`));t.length===0&&(u.error(`Please specify at least one package name`),process.exit(1));try{await b(t,{cwd:process.cwd()}),u.success(`Removed ${t.join(`, `)}`)}catch(e){u.error(`Remove packages failed:`,e),process.exit(1)}}}),re=c({meta:{name:`dlx`,description:`Execute package without installation`},async run({rawArgs:e}){try{e.length===0&&(u.error(`Please specify a package to run`),process.exit(1));let[t,...n]=e;await y(t,{args:n,cwd:process.cwd()}),u.success(`Dlx completed`)}catch(e){u.error(`Dlx failed:`,e),process.exit(1)}}}),$=await i(import.meta.url);l(c({meta:{name:`basis`,description:$.description,version:$.version},subCommands:{init:A,lint:t,fmt:n,build:j,git:B,run:V,version:U,publish:K,audit:Q,add:te,remove:ne,dlx:re}}));export{};
|
package/dist/cli/oxfmt.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import"../_chunks/config-lvw40IpZ.mjs";import"../_chunks/run-D8ZiNeaU.mjs";import{t as e}from"../_chunks/fmt-9Yi9STzz.mjs";import{runMain as t}from"citty";t(e);export{};
|
package/dist/cli/oxlint.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import"../_chunks/config-lvw40IpZ.mjs";import"../_chunks/run-D8ZiNeaU.mjs";import{t as e}from"../_chunks/lint-3A6_NhRY.mjs";import{runMain as t}from"citty";t(e);export{};
|
package/dist/config.d.mts
CHANGED
|
@@ -1,106 +1,8 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import
|
|
1
|
+
import { a as FmtConfig, c as LintConfig, d as RunConfig, h as VersionConfig, l as PublishConfig, n as BasisConfig, o as GitConfig, t as AuditConfig } from "./_chunks/types-C-71QzwD.mjs";
|
|
2
|
+
import * as c12 from "c12";
|
|
3
|
+
import { LoadConfigOptions } from "c12";
|
|
4
|
+
import { defineBuildConfig } from "@funish/build/config";
|
|
3
5
|
|
|
4
|
-
//#region ../build/src/types.d.ts
|
|
5
|
-
interface BuildContext {
|
|
6
|
-
pkgDir: string;
|
|
7
|
-
pkg: {
|
|
8
|
-
name: string;
|
|
9
|
-
} & Record<string, unknown>;
|
|
10
|
-
}
|
|
11
|
-
type _BuildEntry = {
|
|
12
|
-
/**
|
|
13
|
-
* Output directory relative to project root.
|
|
14
|
-
*
|
|
15
|
-
* Defaults to `dist/` if not provided.
|
|
16
|
-
*/
|
|
17
|
-
outDir?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Avoid actual build but instead link to the source files.
|
|
20
|
-
*/
|
|
21
|
-
stub?: boolean;
|
|
22
|
-
};
|
|
23
|
-
type BundleEntry = _BuildEntry & {
|
|
24
|
-
type: "bundle";
|
|
25
|
-
/**
|
|
26
|
-
* Entry point(s) to bundle relative to the project root.
|
|
27
|
-
* */
|
|
28
|
-
input: string | string[];
|
|
29
|
-
/**
|
|
30
|
-
* Minify the output using rolldown.
|
|
31
|
-
*
|
|
32
|
-
* Defaults to `false` if not provided.
|
|
33
|
-
*/
|
|
34
|
-
minify?: boolean | "dce-only" | MinifyOptions;
|
|
35
|
-
/**
|
|
36
|
-
* Options passed to rolldown.
|
|
37
|
-
*
|
|
38
|
-
* See [rolldown config options](https://rolldown.rs/reference/config-options) for more details.
|
|
39
|
-
*/
|
|
40
|
-
rolldown?: InputOptions & {
|
|
41
|
-
plugins?: RolldownPluginOption[];
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Declaration generation options.
|
|
45
|
-
*
|
|
46
|
-
* See [rolldown-plugin-dts](https://github.com/sxzz/rolldown-plugin-dts) for more details.
|
|
47
|
-
*
|
|
48
|
-
* Options are inferred from the `tsconfig.json` file if available.
|
|
49
|
-
*
|
|
50
|
-
* Set to `false` to disable.
|
|
51
|
-
*/
|
|
52
|
-
dts?: boolean | Options;
|
|
53
|
-
};
|
|
54
|
-
type TransformEntry = _BuildEntry & {
|
|
55
|
-
type: "transform";
|
|
56
|
-
/**
|
|
57
|
-
* Directory to transform relative to the project root.
|
|
58
|
-
*/
|
|
59
|
-
input: string;
|
|
60
|
-
/**
|
|
61
|
-
* Minify the output using oxc-minify.
|
|
62
|
-
*
|
|
63
|
-
* Defaults to `false` if not provided.
|
|
64
|
-
*/
|
|
65
|
-
minify?: boolean | MinifyOptions$1;
|
|
66
|
-
/**
|
|
67
|
-
* Options passed to oxc-transform.
|
|
68
|
-
*
|
|
69
|
-
* See [oxc-transform](https://www.npmjs.com/package/oxc-transform) for more details.
|
|
70
|
-
*/
|
|
71
|
-
oxc?: TransformOptions;
|
|
72
|
-
/**
|
|
73
|
-
* Options passed to exsolve for module resolution.
|
|
74
|
-
*
|
|
75
|
-
* See [exsolve](https://github.com/unjs/exsolve) for more details.
|
|
76
|
-
*/
|
|
77
|
-
resolve?: Omit<ResolveOptions, "from">;
|
|
78
|
-
/**
|
|
79
|
-
* A filter function to exclude files from being transformed.
|
|
80
|
-
*/
|
|
81
|
-
filter?: (filePath: string) => boolean | Promise<boolean>;
|
|
82
|
-
/**
|
|
83
|
-
* If sets to `false`, or if the function returns `false`, declaration files won't be emitted for the module.
|
|
84
|
-
*/
|
|
85
|
-
dts?: boolean | ((filePath: string) => boolean | Promise<boolean>);
|
|
86
|
-
};
|
|
87
|
-
type BuildEntry = BundleEntry | TransformEntry;
|
|
88
|
-
interface BuildHooks {
|
|
89
|
-
start?: (ctx: BuildContext) => void | Promise<void>;
|
|
90
|
-
end?: (ctx: BuildContext) => void | Promise<void>;
|
|
91
|
-
entries?: (entries: BuildEntry[], ctx: BuildContext) => void | Promise<void>;
|
|
92
|
-
rolldownConfig?: (cfg: InputOptions, ctx: BuildContext) => void | Promise<void>;
|
|
93
|
-
rolldownOutput?: (cfg: OutputOptions, res: RolldownBuild, ctx: BuildContext) => void | Promise<void>;
|
|
94
|
-
}
|
|
95
|
-
interface BuildConfig {
|
|
96
|
-
cwd?: string | URL;
|
|
97
|
-
entries?: (BuildEntry | string)[];
|
|
98
|
-
hooks?: BuildHooks;
|
|
99
|
-
}
|
|
100
|
-
//#endregion
|
|
101
|
-
//#region ../build/src/config.d.ts
|
|
102
|
-
declare function defineBuildConfig(config: BuildConfig): BuildConfig;
|
|
103
|
-
//#endregion
|
|
104
6
|
//#region src/config.d.ts
|
|
105
7
|
/**
|
|
106
8
|
* Define a Basis configuration
|
|
@@ -109,7 +11,7 @@ declare function defineBasisConfig(config: BasisConfig): BasisConfig;
|
|
|
109
11
|
/**
|
|
110
12
|
* Load Basis configuration with intelligent upward search
|
|
111
13
|
*/
|
|
112
|
-
declare function loadConfig(options?: LoadConfigOptions<BasisConfig>): Promise<ResolvedConfig<{
|
|
14
|
+
declare function loadConfig(options?: LoadConfigOptions<BasisConfig>): Promise<c12.ResolvedConfig<{
|
|
113
15
|
extends?: string | string[];
|
|
114
16
|
lint?: LintConfig;
|
|
115
17
|
fmt?: FmtConfig;
|
|
@@ -118,6 +20,6 @@ declare function loadConfig(options?: LoadConfigOptions<BasisConfig>): Promise<R
|
|
|
118
20
|
audit?: AuditConfig;
|
|
119
21
|
version?: VersionConfig;
|
|
120
22
|
publish?: PublishConfig;
|
|
121
|
-
}, ConfigLayerMeta>>;
|
|
23
|
+
}, c12.ConfigLayerMeta>>;
|
|
122
24
|
//#endregion
|
|
123
25
|
export { defineBasisConfig, defineBuildConfig, loadConfig };
|
package/dist/config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{n as e,r as t,t as n}from"./_chunks/config-lvw40IpZ.mjs";export{n as defineBasisConfig,e as defineBuildConfig,t as loadConfig};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import "./_chunks/
|
|
2
|
-
import { a as FmtConfig, c as LintConfig, d as RunConfig, f as StagedConfig, g as VersionOptions, h as VersionConfig, i as CommitMsgConfig, l as PublishConfig, m as ValidGitHook, n as BasisConfig, o as GitConfig, p as VALID_GIT_HOOKS, r as CommitMessage, s as InitOptions, t as AuditConfig, u as PublishOptions } from "./_chunks/types-DVbgCQzS.mjs";
|
|
1
|
+
import { a as FmtConfig, c as LintConfig, d as RunConfig, f as StagedConfig, g as VersionOptions, h as VersionConfig, i as CommitMsgConfig, l as PublishConfig, m as ValidGitHook, n as BasisConfig, o as GitConfig, p as VALID_GIT_HOOKS, r as CommitMessage, s as InitOptions, t as AuditConfig, u as PublishOptions } from "./_chunks/types-C-71QzwD.mjs";
|
|
3
2
|
export { AuditConfig, BasisConfig, CommitMessage, CommitMsgConfig, FmtConfig, GitConfig, InitOptions, LintConfig, PublishConfig, PublishOptions, RunConfig, StagedConfig, VALID_GIT_HOOKS, ValidGitHook, VersionConfig, VersionOptions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funish/basis",
|
|
3
|
-
"version": "0.2.8-edge.
|
|
3
|
+
"version": "0.2.8-edge.1",
|
|
4
4
|
"description": "A modern development toolkit with unified CLI for package management, versioning, publishing, code quality, and Git workflow automation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"basis",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"pkg-types": "2.3.0",
|
|
78
78
|
"semver": "7.7.4",
|
|
79
79
|
"tinyglobby": "0.2.15",
|
|
80
|
-
"@funish/build": "0.0.
|
|
80
|
+
"@funish/build": "0.0.4-edge.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@types/picomatch": "4.0.2",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{O as e,b as t,v as n,y as r}from"./vendor/common-DNe_sHJp.mjs";const i=(await n(import.meta.url,{alias:{"@funish/build":`E:/basis/packages/build`,"./config":`E:/basis/packages/build/src/config`},transformOptions:{babel:{plugins:[]}}}).import(`E:/basis/packages/build/src/config.ts`)).defineBuildConfig;function a(e){return e}async function o(n={}){if(n.cwd)return await r({name:`basis`,cwd:n.cwd,...n,defaults:{...n.defaults}});let i=process.cwd(),a=await t(i);for(;;){let t=await r({name:`basis`,cwd:i,...n,defaults:{...n.defaults}});if(t._configFile||i===a)return t;i=e(i)}}export{o as n,i as r,a as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as e,h as t}from"./vendor/common-DNe_sHJp.mjs";import{n}from"./config-Coiy-SOC.mjs";import{t as r}from"./run-CYtHqbev.mjs";const i=e({meta:{name:`fmt`,description:`Format code`},async run({rawArgs:e}){let{config:i}=await n(),a=i.fmt?.config||[];r({pkg:`oxfmt`,bin:`cli.js`,args:e.length>0?e:a}).status!==0&&process.exit(1),t.success(`Formatting completed`)}});export{i as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{v as e}from"./vendor/common-DNe_sHJp.mjs";export{e as createJiti,e as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as e}from"./vendor/common-DNe_sHJp.mjs";export{e as parseJSON5};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E as e}from"./vendor/common-DNe_sHJp.mjs";export{e as parseJSONC};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as e,h as t}from"./vendor/common-DNe_sHJp.mjs";import{n}from"./config-Coiy-SOC.mjs";import{t as r}from"./run-CYtHqbev.mjs";const i=e({meta:{name:`lint`,description:`Lint code`},async run({rawArgs:e}){let{config:i}=await n(),a=i.lint?.config||[];r({pkg:`oxlint`,bin:`cli.js`,args:e.length>0?e:a}).status!==0&&process.exit(1),t.success(`Linting completed`)}});export{i as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,r as t}from"./vendor/common-DNe_sHJp.mjs";export{t as n,e as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./vendor/common-DNe_sHJp.mjs";export{e as prompt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as e}from"node:module";var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),c=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},l=(e,r,i)=>(i=e==null?{}:t(a(e)),c(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e)),u=e(import.meta.url);export{u as n,l as r,s as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{O as e,h as t,k as n}from"./vendor/common-DNe_sHJp.mjs";import{createRequire as r}from"node:module";import{spawnSync as i}from"node:child_process";function a(a){let{pkg:o,bin:s,args:c}=a,l=n(e(r(import.meta.url).resolve(o)),s),u=i(process.execPath,[l,...c],{stdio:`inherit`,shell:!1});return u.error&&t.error(u.error),u.status!==0&&t.error(`${o} failed with exit code ${u.status}`),u}export{a as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{w as e}from"./vendor/common-DNe_sHJp.mjs";export{e as parseTOML};
|