@deltabox/toolchain 2.4.0 → 2.6.0
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 +106 -4
- package/dist/biome.d.ts +2 -2
- package/dist/biome.js +1 -1
- package/dist/cli/commands/sync.js +1 -1
- package/dist/cli/commands/watch.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/register.js +1 -1
- package/dist/cli/tooling-commands.js +1 -0
- package/dist/config.d.ts +2 -1
- package/dist/config.js +1 -1
- package/dist/core.d.ts +3 -3
- package/dist/core.js +1 -1
- package/dist/index.d.ts +10 -7
- package/dist/index.js +1 -1
- package/dist/package.js +1 -1
- package/dist/packages/biome/src/index.d.ts +142 -7
- package/dist/packages/biome/src/index.js +1 -1
- package/dist/packages/changelog/src/workflows.d.ts +19 -5
- package/dist/packages/changelog/src/workflows.js +5 -4
- package/dist/packages/config/src/generators/commands.d.ts +22 -0
- package/dist/packages/config/src/generators/commands.js +2 -0
- package/dist/packages/config/src/generators/index.d.ts +2 -1
- package/dist/packages/config/src/generators/index.js +1 -1
- package/dist/packages/config/src/generators/types.js +1 -1
- package/dist/packages/config/src/index.d.ts +3 -2
- package/dist/packages/config/src/index.js +1 -1
- package/dist/packages/config/src/schema.js +1 -1
- package/dist/packages/core/src/editor-config.js +1 -1
- package/dist/packages/core/src/index.d.ts +4 -4
- package/dist/packages/core/src/index.js +1 -1
- package/dist/packages/core/src/loader.js +1 -1
- package/dist/packages/core/src/sync.d.ts +6 -0
- package/dist/packages/core/src/sync.js +1 -1
- package/dist/packages/core/src/watch.d.ts +41 -0
- package/dist/packages/core/src/watch.js +1 -1
- package/dist/packages/migrate/src/oxlint-map.d.ts +34 -1
- package/dist/packages/migrate/src/oxlint-map.js +1 -1
- package/dist/packages/project/src/cli/index.js +1 -1
- package/dist/packages/project/src/index.d.ts +3 -3
- package/dist/packages/project/src/index.js +1 -1
- package/dist/packages/project/src/sync.js +1 -1
- package/dist/packages/project/src/typescript.d.ts +12 -4
- package/dist/packages/project/src/typescript.js +12 -11
- package/dist/packages/shared/src/config-schema/alias-rewrite.d.ts +32 -0
- package/dist/packages/shared/src/config-schema/biome.js +1 -1
- package/dist/packages/shared/src/config-schema/changelog.d.ts +293 -288
- package/dist/packages/shared/src/config-schema/ci.d.ts +888 -864
- package/dist/packages/shared/src/config-schema/format.d.ts +4 -6
- package/dist/packages/shared/src/config-schema/format.js +1 -1
- package/dist/packages/shared/src/config-schema/generated/gitlab-ci.d.ts +1 -1
- package/dist/packages/shared/src/config-schema/generated/oxfmt-config.d.ts +1 -1
- package/dist/packages/shared/src/config-schema/index.d.ts +2739 -2602
- package/dist/packages/shared/src/config-schema/json.d.ts +1 -1
- package/dist/packages/shared/src/config-schema/tsconfig.d.ts +21 -0
- package/dist/packages/shared/src/config-schema/tsconfig.js +1 -1
- package/dist/packages/shared/src/config-schema/vendor-types.d.ts +156 -0
- package/dist/packages/shared/src/config-schema/workflow.d.ts +1741 -1704
- package/dist/packages/shared/src/config-schema/workflow.js +1 -1
- package/dist/packages/shared/src/config-types.d.ts +102 -28
- package/dist/packages/shared/src/ignore.d.ts +5 -5
- package/dist/packages/shared/src/ignore.js +1 -1
- package/dist/packages/shared/src/index.d.ts +8 -5
- package/dist/packages/shared/src/index.js +1 -1
- package/dist/packages/shared/src/template.d.ts +1 -1
- package/dist/packages/shared/src/toolchain.d.ts +12 -3
- package/dist/packages/shared/src/toolchain.js +1 -1
- package/dist/packages/shared/src/tsconfig-files.d.ts +14 -0
- package/dist/packages/shared/src/tsconfig-files.js +1 -0
- package/dist/packages/shared/src/types.d.ts +4 -2
- package/dist/packages/shared/src/vite-defaults.d.ts +71 -4
- package/dist/packages/shared/src/vite-defaults.js +1 -1
- package/dist/packages/shared/src/yaml.d.ts +1 -1
- package/dist/packages/tsconfig/src/auto.d.ts +11 -0
- package/dist/packages/tsconfig/src/auto.js +1 -0
- package/dist/packages/tsconfig/src/cli/generate/index.d.ts +58 -0
- package/dist/packages/tsconfig/src/cli/generate/index.js +1 -1
- package/dist/packages/tsconfig/src/cli/generate/utils.d.ts +12 -0
- package/dist/packages/tsconfig/src/cli/generate/utils.js +1 -1
- package/dist/packages/tsconfig/src/cli/index.js +1 -1
- package/dist/packages/tsconfig/src/files.d.ts +5 -0
- package/dist/packages/tsconfig/src/files.js +1 -0
- package/dist/packages/tsconfig/src/index.d.ts +6 -5
- package/dist/packages/tsconfig/src/index.js +1 -1
- package/dist/packages/tsconfig/src/overrides.d.ts +3 -3
- package/dist/packages/tsconfig/src/resolve.d.ts +15 -3
- package/dist/packages/tsconfig/src/resolve.js +1 -1
- package/dist/packages/tsconfig/src/sync.d.ts +5 -11
- package/dist/packages/tsconfig/src/sync.js +1 -1
- package/dist/packages/tsconfig/src/templates.d.ts +38 -4
- package/dist/packages/tsconfig/src/workspaces.d.ts +36 -0
- package/dist/packages/tsconfig/src/workspaces.js +1 -0
- package/dist/packages/tsdown/src/config/node.js +1 -1
- package/dist/packages/vite/src/commands.js +1 -1
- package/dist/project.d.ts +2 -2
- package/dist/project.js +1 -1
- package/dist/shared.d.ts +7 -4
- package/dist/shared.js +1 -1
- package/dist/sync.d.ts +2 -0
- package/dist/sync.js +1 -1
- package/dist/tooling.d.ts +18 -1
- package/dist/tooling.js +1 -1
- package/dist/tsconfig.d.ts +5 -4
- package/dist/tsconfig.js +1 -1
- package/package.json +15 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"node:path";import"node:url";import.meta.url;import{logger as t}from"../../shared/src/logger.js";import"../../shared/src/index.js";import{resolveProjectType as n}from"./project-type.js";import{ensureDbxGitignore as r}from"./gitignore.js";import{readManifest as i,writeManifest as a}from"./manifest.js";import{resolveManagedPath as o}from"./paths.js";import s from"node:fs";function c(e){return e.replace(/\\/g,`/`)}
|
|
1
|
+
import{default as e}from"node:path";import"node:url";import.meta.url;import{logger as t}from"../../shared/src/logger.js";import"../../shared/src/index.js";import{resolveProjectType as n}from"./project-type.js";import{ensureDbxGitignore as r}from"./gitignore.js";import{readManifest as i,writeManifest as a}from"./manifest.js";import{resolveManagedPath as o}from"./paths.js";import s from"node:fs";function c(e){return e.replace(/\\/g,`/`)}function l(e,t){let n=new Map(e.map(e=>[e.name,e])),r=t.filter(e=>!n.has(e));if(r.length>0)throw Error(`unknown sync task(s): ${r.join(`, `)} (available: ${e.map(e=>e.name).join(`, `)})`);return t.map(e=>n.get(e))}async function u(u){let{cwd:d,config:f,ownConfig:p,tokens:m}=u,h=u.only&&u.only.length>0?u.only:void 0,g=h?l(u.tasks,h):u.tasks,_=!h&&u.prune!==!1,v=u.quiet?()=>{}:u.log??(e=>t.info(e)),y=u.quiet?()=>{}:(e,n)=>t.warn(e,n),b=u.projectType??n(d,f),x=i(d),S={cwd:d,projectType:b,config:f,ownConfig:p??f,tokens:m,log:v,warn:y,check:u.check===!0,managedFiles:x.files,manifest:{...x.extras,...x.tsconfigOverrides?{tsconfigOverrides:x.tsconfigOverrides}:{},...x.snapshots?{snapshots:x.snapshots}:{}}},C=f.hooks??{};await C.beforeSync?.(S);let w=g.filter(e=>(!e.projectTypes||e.projectTypes.includes(b))&&(!e.enabled||e.enabled(f)));v(`running ${w.length} task(s)${u.check?` (check)`:``} [${b}]`);let T=[];for(let e of w){v(` - ${e.name}`),await C.beforeTask?.({task:e,ctx:S});let t=await e.run(S),n=Array.isArray(t)?t:void 0;n&&T.push(...n),await C.afterTask?.({task:e,ctx:S,...n?{files:n}:{}})}for(let e of T)o(d,e.path);let E=new Map(T.map(t=>{let n=o(d,t.path);return[c(e.relative(d,n)),t.content]})),D=new Set(T.filter(e=>e.track===!1).map(e=>c(e.path))),O=/* @__PURE__ */ new Set;for(let e of g){if(e.projectTypes&&!e.projectTypes.includes(b))continue;let t=typeof e.keep==`function`?e.keep(f):e.keep??[];for(let e of t)O.add(e)}let k=e=>{for(let t of O)if(e===t||e.endsWith(`/${t}`)||e.endsWith(t))return!0;return!1},A=[];for(let[t,n]of E){let r=e.resolve(d,t);(s.existsSync(r)?s.readFileSync(r,`utf-8`):void 0)!==n&&A.push(t)}let j=new Map([...E.keys()].map(t=>[t,s.existsSync(e.resolve(d,t))])),M=e=>x.origins?.[e]||(x.files.includes(e)||j.get(e)?`adopted`:`created`),N=[],P=[];for(let e of x.files){if(!_||E.has(e)||D.has(e)||k(e)||M(e)!==`created`)continue;let t;try{t=o(d,e)}catch(t){y(`sync: ignoring unsafe manifest path "${e}": ${t instanceof Error?t.message:String(t)}`);continue}s.existsSync(t)&&(N.push(e),P.push({path:e,content:s.readFileSync(t,`utf-8`)}))}let F=A.length===0&&N.length===0;if(u.check){if(F)v(`generated files are in sync.`);else{v(`generated files are out of date:`);for(let e of A)v(` M ${e}`);for(let e of N)v(` D ${e}`);v("Run `dbx sync` to regenerate them.")}let e={written:[],changed:A,removed:N,removedFiles:P,upToDate:F};return await C.afterSync?.({cwd:d,config:f,result:e}),e}let I=[];for(let[t,n]of E){let r=e.resolve(d,t);s.mkdirSync(e.dirname(r),{recursive:!0}),s.writeFileSync(r,n,`utf-8`),I.push(t)}for(let t of N)s.rmSync(e.resolve(d,t),{force:!0});let L=[.../* @__PURE__ */ new Set([..._?[]:x.files,...E.keys()])].filter(e=>!D.has(e)),R={};for(let e of L)R[e]=M(e);a(d,L,void 0,R,S.manifest),r(d)&&v(` I .gitignore (added the .dbx ignore block)`),v(`wrote ${I.length}, removed ${N.length} file(s)${A.length?`, updated ${A.length}`:``}.`);let z={written:I,changed:A,removed:N,removedFiles:P,upToDate:F};return await C.afterSync?.({cwd:d,config:f,result:z}),z}export{u as runSync,l as selectSyncTasks};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import __tsdown_shims_path from 'node:path';
|
|
2
2
|
import __tsdown_shims_url from 'node:url';
|
|
3
3
|
import { ProjectType } from "../../shared/src/config-types.js";
|
|
4
|
+
import { ProjectGraph } from "./graph.js";
|
|
4
5
|
import { RunSyncOptions } from "./sync.js";
|
|
5
6
|
import { SyncTask, ToolchainConfig } from "../../shared/src/toolchain.js";
|
|
7
|
+
import { TsconfigFileNameSet } from "../../shared/src/tsconfig-files.js";
|
|
6
8
|
import "../../shared/src/index.js";
|
|
7
9
|
//#region packages/core/src/watch.d.ts
|
|
8
10
|
export interface RunWatchOptions extends Omit<RunSyncOptions, 'check'> {
|
|
@@ -21,6 +23,45 @@ export interface RunWatchOptions extends Omit<RunSyncOptions, 'check'> {
|
|
|
21
23
|
* resolved against the config (eg. custom tsconfig file names).
|
|
22
24
|
*/
|
|
23
25
|
export declare function resolveWatchGlobs(tasks: SyncTask[], config: ToolchainConfig, projectType?: ProjectType): string[];
|
|
26
|
+
/**
|
|
27
|
+
* The legacy/default watch globs. The extension resolves these to concrete,
|
|
28
|
+
* non-recursive repo-relative files via {@link resolveWatchInputFiles}; this
|
|
29
|
+
* const is exported for consumers that still want the wide patterns.
|
|
30
|
+
*/
|
|
31
|
+
export declare const DEFAULT_WATCH_GLOBS: readonly ['**/dbx.config.*', 'tsconfig.workspaces.json', '**/tsconfig.default.json'];
|
|
32
|
+
export interface ResolveWatchInputFilesOptions {
|
|
33
|
+
/** Repo root. */
|
|
34
|
+
cwd: string;
|
|
35
|
+
/** The merged root config. */
|
|
36
|
+
config: ToolchainConfig;
|
|
37
|
+
/** The detected/config project type. */
|
|
38
|
+
projectType?: ProjectType;
|
|
39
|
+
/** The sync tasks to derive task-level inputs from. */
|
|
40
|
+
tasks?: SyncTask[];
|
|
41
|
+
/** A prebuilt project graph (default: built from `cwd`). */
|
|
42
|
+
graph?: ProjectGraph;
|
|
43
|
+
/** Explicit user globs; when set they replace the resolved inputs. */
|
|
44
|
+
userGlobs?: string[];
|
|
45
|
+
/** Extra glob(s) to exclude. */
|
|
46
|
+
exclude?: string | string[];
|
|
47
|
+
/** Respect `.gitignore` files (default true). */
|
|
48
|
+
gitignore?: boolean;
|
|
49
|
+
}
|
|
50
|
+
export interface ResolvedWatchInputFiles {
|
|
51
|
+
/** Concrete, repo-relative (posix), non-recursive paths to watch. */
|
|
52
|
+
globs: string[];
|
|
53
|
+
/** Every `dbx.config.*` path. */
|
|
54
|
+
configs: string[];
|
|
55
|
+
/** The root tsconfig file names (drives project detection). */
|
|
56
|
+
tsconfig: TsconfigFileNameSet;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Resolve the exact files the auto-sync watcher should watch. Unlike the legacy
|
|
60
|
+
* recursive globs, this uses the project graph (plus each project's own config)
|
|
61
|
+
* so only the necessary config/tsconfig files are watched, and custom file names
|
|
62
|
+
* are honoured.
|
|
63
|
+
*/
|
|
64
|
+
export declare function resolveWatchInputFiles(options: ResolveWatchInputFilesOptions): Promise<ResolvedWatchInputFiles>;
|
|
24
65
|
/**
|
|
25
66
|
* Run one sync, then watch the config file + every task's `watch` globs and
|
|
26
67
|
* re-run on change. Writing generated files must not re-trigger a run, so a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"node:path";import"node:url";import.meta.url;import{isIgnoredPath as
|
|
1
|
+
import{default as e}from"node:path";import"node:url";import.meta.url;import{deepMerge as t}from"../../shared/src/object-utils.js";import{isIgnoredPath as n,resolveIgnorePatterns as r}from"../../shared/src/ignore.js";import{logger as i}from"../../shared/src/logger.js";import{sectionConfig as a,sectionEnabled as o}from"../../shared/src/toolchain.js";import{tsconfigFileNames as s}from"../../shared/src/tsconfig-files.js";import"../../shared/src/index.js";import{resolveProjectType as c}from"./project-type.js";import{findConfigFile as l,loadToolchainConfig as u}from"./loader.js";import{buildProjectGraph as d}from"./graph.js";import{runSync as f,selectSyncTasks as p}from"./sync.js";import m from"node:fs";import{globSync as h}from"glob";function g(e,t,n){let r=/* @__PURE__ */ new Set;for(let i of e){if(n&&i.projectTypes&&!i.projectTypes.includes(n)||i.enabled&&!i.enabled(t))continue;let e=typeof i.watch==`function`?i.watch(t):i.watch??[];for(let t of e)r.add(t)}return[...r]}const _=[`**/dbx.config.*`,`tsconfig.workspaces.json`,`**/tsconfig.default.json`];function v(t,n){return e.relative(t,n).replace(/\\/g,`/`)}function y(e){let t=e.replace(/\\/g,`/`);return!t||t.startsWith(`/`)||/^[a-zA-Z]:/.test(t)?!1:t.split(`/`).every(e=>e!==`..`)}async function b(i){let c=e.resolve(i.cwd),f=s(i.config),p=i.userGlobs;if(p)return{globs:[...new Set(p)].filter(y),configs:[],tsconfig:f};let g=i.graph??d(c),_=r(c,{...i.exclude===void 0?{}:{exclude:i.exclude},...i.gitignore===void 0?{}:{gitignore:i.gitignore}}),b=/* @__PURE__ */ new Set,x=/* @__PURE__ */ new Set,S=t=>{if(!t||t===`.`||e.isAbsolute(t))return;let r=t.replace(/\\/g,`/`).replace(/^\.\//,``);y(r)&&(n(r,_)||b.add(r))},C=t=>{m.existsSync(e.resolve(c,t))&&S(t)};for(let e of g.projects){let t=e.config;e.hasConfig&&t&&(S(t),x.add(t))}let w=l(c);if(w){let e=v(c,w);S(e),x.add(e)}let T=o(i.config.tsconfig),E=a(i.config.tsconfig)??{};for(let n of g.projects){let r=e.resolve(c,n.dir),l;if(n.dir!==`.`&&n.hasConfig)try{l=(await u(r,{tolerant:!0,skipHooks:!0})).ownConfig?.tsconfig}catch{l=void 0}if(!T||l!==void 0&&!o(l))continue;let d=l!==void 0&&typeof l==`object`?a(l)??{}:{},f=t(E,d),p=s({...i.config,tsconfig:f}),m=n.dir===`.`?``:`${n.dir}/`;C(`${m}${p.defaultFile}`),C(`${m}${p.baseFile}`),n.dir===`.`&&C(p.rootFile)}for(let e of h(`**/${f.defaultFile}`,{cwd:c,nodir:!0,ignore:_}))S(e);for(let e of i.tasks??[]){if(e.enabled&&!e.enabled(i.config))continue;let t=typeof e.watch==`function`?e.watch(i.config):e.watch??[];for(let e of t){if(!e.includes(`**`)){C(e);continue}let t=e.replace(/^\*\*\//,``);for(let e of g.projects)C(`${e.dir===`.`?``:`${e.dir}/`}${t}`)}}return{globs:[...b].sort(),configs:[...x].sort(),tsconfig:f}}async function x(t){let{cwd:o}=t,s=t.only&&t.only.length>0?p(t.tasks,t.only):t.tasks,d=t.configPath?e.resolve(o,t.configPath):void 0,h=t.quiet?()=>{}:t.log??(e=>i.info(e)),g={...t},_=[],v=[],y=0,x,S=!1,C=!1,w=!1,T=!1,E=()=>a(g.config.watch)?.debounce??t.debounce??150,D=()=>{for(let e of v)e.close();v=[]},O=async()=>{let e=t.configPath?l(o):void 0,n=d&&m.existsSync(d)?d:e;if(!n)return!1;d=n;try{let e=await u(o,{config:n,fresh:!0});return g={...g,config:e.config,ownConfig:e.ownConfig,tokens:e.tokens,projectType:e.projectType},!0}catch(e){return i.error(`failed to reload ${d}: ${e instanceof Error?e.message:String(e)}`),!1}},k=async()=>{if(S)C=!0;else{S=!0;try{w&&(w=!1,await O()&&(T=!0)),await f(g)}catch(e){i.error(`sync failed: ${e instanceof Error?e.message:String(e)}`)}finally{S=!1,y=Date.now()+Math.max(E()*3,300),T&&(T=!1,await N()),C&&(C=!1,A())}}},A=()=>{clearTimeout(x),x=setTimeout(()=>{k()},E())},j=t=>{let r=!1;if(t){let i=e.relative(o,t).replace(/\\/g,`/`);if(n(i,_))return;r=e.basename(t).startsWith(`dbx.config.`),r&&(w=!0)}Date.now()<y&&!r||(g.config?.hooks?.onChange?.(t?{path:t}:{}),A())},M=e=>{e.on(`error`,e=>{i.error(`watch error: ${e instanceof Error?e.message:String(e)}`)}),v.push(e)};async function N(){D();let n=a(g.config.watch);_=r(o,{...(n?.exclude??t.exclude)===void 0?{}:{exclude:n?.exclude??t.exclude},...(n?.gitignore??t.gitignore)===void 0?{}:{gitignore:n?.gitignore??t.gitignore}});let i=g.projectType??c(o,g.config),l=await b({cwd:o,config:g.config,projectType:i,tasks:s,...n?.exclude??t.exclude?{exclude:n?.exclude??t.exclude}:{},...n?.gitignore??t.gitignore?{gitignore:n?.gitignore??t.gitignore}:{}});if(d)try{M(m.watch(d,()=>{h(`config changed; re-syncing`),w=!0,j(d)}))}catch{}for(let t of l.globs){let n=e.resolve(o,t);try{M(m.watch(n,()=>j(n)))}catch{}}}await k(),await N(),h(`watching for changes (Ctrl+C to stop)`),await new Promise(e=>{let t=()=>{x&&clearTimeout(x),x=void 0,D(),process.off(`SIGINT`,t),process.off(`SIGTERM`,t),e()};process.on(`SIGINT`,t),process.on(`SIGTERM`,t)})}export{_ as DEFAULT_WATCH_GLOBS,g as resolveWatchGlobs,b as resolveWatchInputFiles,x as runWatch};
|
|
@@ -7,7 +7,40 @@ type Json = Record<string, any>;
|
|
|
7
7
|
* Biome rule path -> Oxlint rule name. `null` means "no known equivalent".
|
|
8
8
|
* Bare names are core ESLint rules; prefixed names use an Oxlint plugin.
|
|
9
9
|
*/
|
|
10
|
-
export declare const RULE_MAP:
|
|
10
|
+
export declare const RULE_MAP: {
|
|
11
|
+
readonly 'a11y.useAltText': 'jsx-a11y/alt-text';
|
|
12
|
+
readonly 'a11y.useButtonType': 'react/button-has-type';
|
|
13
|
+
readonly 'a11y.useKeyWithClickEvents': 'jsx-a11y/click-events-have-key-events';
|
|
14
|
+
readonly 'a11y.noSvgWithoutTitle': null;
|
|
15
|
+
readonly 'a11y.useAriaPropsForRole': null;
|
|
16
|
+
readonly 'a11y.useFocusableInteractive': null;
|
|
17
|
+
readonly 'a11y.useSemanticElements': 'jsx-a11y/prefer-tag-over-role';
|
|
18
|
+
readonly 'a11y.noStaticElementInteractions': null;
|
|
19
|
+
readonly 'a11y.noLabelWithoutControl': 'jsx-a11y/label-has-associated-control';
|
|
20
|
+
readonly 'complexity.noBannedTypes': 'typescript/no-empty-object-type';
|
|
21
|
+
readonly 'complexity.noUselessEmptyExport': 'typescript/no-useless-empty-export';
|
|
22
|
+
readonly 'complexity.noUselessEscapeInRegex': 'no-useless-escape';
|
|
23
|
+
readonly 'complexity.noImportantStyles': null;
|
|
24
|
+
readonly 'complexity.noStaticOnlyClass': 'unicorn/no-static-only-class';
|
|
25
|
+
readonly 'correctness.noConstantCondition': 'no-constant-condition';
|
|
26
|
+
readonly 'correctness.noInnerDeclarations': 'no-inner-declarations';
|
|
27
|
+
readonly 'correctness.noUnusedVariables': 'no-unused-vars';
|
|
28
|
+
readonly 'correctness.noUnusedFunctionParameters': 'no-unused-vars';
|
|
29
|
+
readonly 'correctness.noUnusedImports': 'no-unused-vars';
|
|
30
|
+
readonly 'correctness.noSwitchDeclarations': 'no-case-declarations';
|
|
31
|
+
readonly 'correctness.useExhaustiveDependencies': 'react-hooks/exhaustive-deps';
|
|
32
|
+
readonly 'style.useExponentiationOperator': 'prefer-exponentiation-operator';
|
|
33
|
+
readonly 'style.noNonNullAssertion': 'typescript/no-non-null-assertion';
|
|
34
|
+
readonly 'style.useNodejsImportProtocol': 'unicorn/prefer-node-protocol';
|
|
35
|
+
readonly 'style.useTemplate': 'prefer-template';
|
|
36
|
+
readonly 'suspicious.noDoubleEquals': 'eqeqeq';
|
|
37
|
+
readonly 'suspicious.noExplicitAny': 'typescript/no-explicit-any';
|
|
38
|
+
readonly 'suspicious.noAssignInExpressions': 'no-return-assign';
|
|
39
|
+
readonly 'suspicious.noUselessEscapeInString': 'no-useless-escape';
|
|
40
|
+
readonly 'suspicious.noImplicitAnyLet': null;
|
|
41
|
+
readonly 'suspicious.noUnknownAtRules': null;
|
|
42
|
+
readonly 'performance.noAccumulatingSpread': 'oxc/no-accumulating-spread';
|
|
43
|
+
};
|
|
11
44
|
export interface OxlintMapping {
|
|
12
45
|
oxlint: Json;
|
|
13
46
|
unmapped: UnmappedItem[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"node:path";import"node:url";import.meta.url;const e={"a11y.useAltText":`jsx-a11y/alt-text`,"a11y.useButtonType":`react/button-has-type`,"a11y.useKeyWithClickEvents":`jsx-a11y/click-events-have-key-events`,"a11y.noSvgWithoutTitle":null,"a11y.useAriaPropsForRole":null,"a11y.useFocusableInteractive":null,"a11y.useSemanticElements":`jsx-a11y/prefer-tag-over-role`,"a11y.noStaticElementInteractions":null,"a11y.noLabelWithoutControl":`jsx-a11y/label-has-associated-control`,"complexity.noBannedTypes":`typescript/no-empty-object-type`,"complexity.noUselessEmptyExport":`typescript/no-useless-empty-export`,"complexity.noUselessEscapeInRegex":`no-useless-escape`,"complexity.noImportantStyles":null,"complexity.noStaticOnlyClass":`unicorn/no-static-only-class`,"correctness.noConstantCondition":`no-constant-condition`,"correctness.noInnerDeclarations":`no-inner-declarations`,"correctness.noUnusedVariables":`no-unused-vars`,"correctness.noUnusedFunctionParameters":`no-unused-vars`,"correctness.noUnusedImports":`no-unused-vars`,"correctness.noSwitchDeclarations":`no-case-declarations`,"correctness.useExhaustiveDependencies":`react-hooks/exhaustive-deps`,"style.useExponentiationOperator":`prefer-exponentiation-operator`,"style.noNonNullAssertion":`typescript/no-non-null-assertion`,"style.useNodejsImportProtocol":`unicorn/prefer-node-protocol`,"style.useTemplate":`prefer-template`,"suspicious.noDoubleEquals":`eqeqeq`,"suspicious.noExplicitAny":`typescript/no-explicit-any`,"suspicious.noAssignInExpressions":`no-return-assign`,"suspicious.noUselessEscapeInString":`no-useless-escape`,"suspicious.noImplicitAnyLet":null,"suspicious.noUnknownAtRules":null,"performance.noAccumulatingSpread":`oxc/no-accumulating-spread`};function t(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`)return e.level}function
|
|
1
|
+
import"node:path";import"node:url";import.meta.url;const e={"a11y.useAltText":`jsx-a11y/alt-text`,"a11y.useButtonType":`react/button-has-type`,"a11y.useKeyWithClickEvents":`jsx-a11y/click-events-have-key-events`,"a11y.noSvgWithoutTitle":null,"a11y.useAriaPropsForRole":null,"a11y.useFocusableInteractive":null,"a11y.useSemanticElements":`jsx-a11y/prefer-tag-over-role`,"a11y.noStaticElementInteractions":null,"a11y.noLabelWithoutControl":`jsx-a11y/label-has-associated-control`,"complexity.noBannedTypes":`typescript/no-empty-object-type`,"complexity.noUselessEmptyExport":`typescript/no-useless-empty-export`,"complexity.noUselessEscapeInRegex":`no-useless-escape`,"complexity.noImportantStyles":null,"complexity.noStaticOnlyClass":`unicorn/no-static-only-class`,"correctness.noConstantCondition":`no-constant-condition`,"correctness.noInnerDeclarations":`no-inner-declarations`,"correctness.noUnusedVariables":`no-unused-vars`,"correctness.noUnusedFunctionParameters":`no-unused-vars`,"correctness.noUnusedImports":`no-unused-vars`,"correctness.noSwitchDeclarations":`no-case-declarations`,"correctness.useExhaustiveDependencies":`react-hooks/exhaustive-deps`,"style.useExponentiationOperator":`prefer-exponentiation-operator`,"style.noNonNullAssertion":`typescript/no-non-null-assertion`,"style.useNodejsImportProtocol":`unicorn/prefer-node-protocol`,"style.useTemplate":`prefer-template`,"suspicious.noDoubleEquals":`eqeqeq`,"suspicious.noExplicitAny":`typescript/no-explicit-any`,"suspicious.noAssignInExpressions":`no-return-assign`,"suspicious.noUselessEscapeInString":`no-useless-escape`,"suspicious.noImplicitAnyLet":null,"suspicious.noUnknownAtRules":null,"performance.noAccumulatingSpread":`oxc/no-accumulating-spread`};function t(t){return Object.hasOwn(e,t)}function n(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`)return e.level}function r(e){if(e===`error`)return`error`;if(e===`warn`)return`warn`;if(e===`info`||e===`off`)return`off`}function i(e){let t=[];for(let[n,r]of Object.entries(e??{}))if(r&&typeof r==`object`)for(let[e,i]of Object.entries(r))t.push([`${n}.${e}`,i]);return t}function a(a,o){let s={},c=[];for(let[o,l]of i(a.linter?.rules??{})){let i=r(n(l));if(!i)continue;let a=t(o)?e[o]:void 0;a===void 0?c.push({source:`linter.rules.${o}`,reason:`not in the Biome->Oxlint map`}):a===null?c.push({source:`linter.rules.${o}`,reason:`no Oxlint equivalent`}):s[a]=i}return{oxlint:{$schema:`./node_modules/oxlint/configuration_schema.json`,rules:s,ignorePatterns:o},unmapped:c}}export{e as RULE_MAP,a as mapBiomeToOxlint};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"node:path";import"node:url";import.meta.url;import{logger as t}from"../../../shared/src/logger.js";import{sectionConfig as n}from"../../../shared/src/toolchain.js";import"../../../shared/src/index.js";import{loadToolchainConfig as
|
|
1
|
+
import{default as e}from"node:path";import"node:url";import.meta.url;import{logger as t}from"../../../shared/src/logger.js";import{sectionConfig as n}from"../../../shared/src/toolchain.js";import{tsconfigFileNames as r}from"../../../shared/src/tsconfig-files.js";import"../../../shared/src/index.js";import{loadToolchainConfig as i}from"../../../core/src/loader.js";import"../../../core/src/index.js";import{hasCatalog as a}from"../catalogs.js";import"../../../tsconfig/src/index.js";import{SCAFFOLD_CATALOG as o,createMonorepoRootFiles as s,createRootProjectFiles as c,createWorkspaceFiles as l,findRootOxcFiles as u,isConfigExtension as d,upsertWorkspaceTsconfig as f,workspaceDirForTsconfig as p,writeGeneratedFiles as m}from"../typescript.js";import{generateProjectConfigs as h}from"../config.js";import{cancel as g,confirm as _,isCancel as v,select as y}from"@clack/prompts";const b=[{flags:`--no-config`,description:`Skip the dbx.config.ts file.`},{flags:`--type <type>`,description:`Project type: project | monorepo-root | monorepo-workspace.`},{flags:`--force`,description:`Overwrite existing files in the output directory.`}],x={flags:`--package-manager <pm>`,description:`Package manager: yarn (default) | pnpm | npm | bun.`},S=[`project`,`monorepo-root`,`monorepo-workspace`];function C(e){return!!(process.stdin.isTTY&&process.stdout.isTTY)&&e.json!==!0}function w(){g(`Cancelled.`),process.exitCode=1}function T(e){if(e==null||e===``)return;let t=String(e).toLowerCase();if(t===`ts`||t===`typescript`)return`ts`;if(t===`js`||t===`javascript`)return`js`;throw Error(`invalid config language "${e}" (expected: ts | js).`)}function E(e){if(e==null||e===``)return;let t=String(e).toLowerCase().replace(/^\./,``);if(!d(t))throw Error(`invalid config extension "${e}" (expected: ts | mts | js | mjs | cjs).`);return t}function D(e){if(e!=null&&e!==``)return String(e)}function O(e,t={}){let n=D(e.description);return{...t.description!==!1&&n?{description:n}:{},...D(e.author)?{author:D(e.author)}:{},...D(e.license)?{license:D(e.license)}:{},...D(e.homepage)?{homepage:D(e.homepage)}:{},...D(e.repo)?{repo:D(e.repo)}:{},...D(e.nodeVersion)?{nodeVersion:D(e.nodeVersion)}:{}}}function k(e,t){let n=D(t.packageManager),r=e.packageManager??n??`yarn`,i=r===n?D(t.packageManagerVersion)??D(t.yarnVersion):void 0;return{packageManager:r,...i?{packageManagerVersion:i}:{}}}function A(e,t){let n=String(e.name??t.project?.name??``).trim();if(!n)throw Error("a project name is required: pass `--name <name>` or set `project.name` in dbx.config.*.");return n}function j(t,n){return t===`.`?e.basename(e.resolve(n)):t}function M(e,t){let n=e.type??t;if(!S.includes(n))throw Error(`invalid project type "${n}" (expected one of: ${S.join(`, `)}).`);return n}function N(e){return n(e.tsconfig)?.extends}function P(){return[{name:`project:init`,description:`Scaffold a single-package TypeScript project.`,options:[{flags:`-n, --name <name>`,description:`Project name.`},{flags:`-s, --scope <scope>`,description:`npm scope, eg. @acme.`},{flags:`-o, --out <dir>`,description:`Output directory (default: cwd).`},x,...b],run:(e,n)=>{let r=e.out??n.cwd,i=j(A(e,n.config),r),a=N(n.config),o=e.scope??D(n.tokens.scope),s=c({...O(n.tokens),name:i,...o?{scope:o}:{},...k(e,n.tokens),type:M(e,`project`),includeConfig:n.noConfig?!1:e.config??!0,rootOxc:u(r),...a?{tsconfigExtends:a}:{}}),l=m(s,r,{force:!!e.force});for(let e of l)t.info(`Created ${e}`)}},{name:`project:init:monorepo`,description:`Scaffold a monorepo root (add --example for one example workspace).`,options:[{flags:`-n, --name <name>`,description:`Project name.`},{flags:`-s, --scope <scope>`,description:`npm scope, eg. @acme.`},{flags:`-o, --out <dir>`,description:`Output directory (default: cwd).`},{flags:`--example`,description:`Also scaffold one example workspace package.`},x,...b],run:(e,n)=>{let r=e.out??n.cwd,i=j(A(e,n.config),r),a=e.scope??D(n.tokens.scope)??`@${i}`,o=n.noConfig?!1:e.config??!0,c=M(e,`monorepo-root`),u=!!e.example,d=k(e,n.tokens),f=N(n.config),p=s({...O(n.tokens),name:i,scope:a,type:c,includeConfig:o,...d,...f?{tsconfigExtends:f}:{},workspaces:u?[{alias:`core`,dir:`packages/core`}]:[]});u&&p.push(...l({...O(n.tokens,{description:!1}),name:i,scope:a,wsName:`core`,wsDir:`packages/core`,type:`monorepo-workspace`,includeConfig:o,useCatalog:!0,...d,...f?{tsconfigExtends:f}:{}}).map(e=>({...e,path:`packages/core/${e.path}`})));let h=m(p,r,{force:!!e.force});for(let e of h)t.info(`Created ${e}`)}},{name:`project:init:workspace`,description:`Scaffold a monorepo workspace package into an existing monorepo root.`,options:[{flags:`-n, --name <name>`,description:`Workspace package name (unscoped).`},{flags:`-s, --scope <scope>`,description:`npm scope, eg. @acme.`},{flags:`-r, --root <dir>`,description:`Monorepo root (default: cwd).`},{flags:`-d, --dir <dir>`,description:`Workspace dir relative to the root (default: packages/<name>).`},x,...b],run:async(n,s)=>{let c=n.root??s.cwd,{config:u,tokens:d}=e.resolve(c)===e.resolve(s.cwd)?{config:s.config,tokens:s.tokens}:await i(c,{tolerant:!0,skipHooks:!0,...s.noConfig?{noConfig:!0}:{}}),h=String(n.name??``).trim();if(!h)throw Error("a workspace name is required: pass `--name <name>` (the root project name is not the workspace name).");let g=j(h,c),_=D(d.name)??e.basename(e.resolve(c)),v=n.scope??D(d.scope)??`@${_}`,y=(n.dir??`packages/${g}`).replace(/\\/g,`/`).replace(/\/+$/,``);p(y);let b=s.noConfig?!1:n.config??!0,x=M(n,`monorepo-workspace`),S=k(n,d),C=N(u),w=l({...O(d,{description:!1}),name:g,scope:v,wsName:g,wsDir:y,type:x,includeConfig:b,useCatalog:a(c,S.packageManager,Object.keys(o)),...S,...C?{tsconfigExtends:C}:{}}).map(e=>({...e,path:`${y}/${e.path}`})),T=m(w,c,{force:!!n.force});f(c,{alias:g,dir:y},v,r(u).rootFile);for(let e of T)t.info(`Created ${e}`)}},{name:`project:config`,description:`Generate dbx.config.* for existing projects that are missing one.`,options:[{flags:`--cwd <dir>`,description:`Root to scan (default: cwd).`},{flags:`--include <pattern...>`,description:`Only projects matching these patterns (glob or substring).`},{flags:`--exclude <pattern...>`,description:`Skip projects matching these patterns (glob or substring).`},{flags:`--type <type>`,description:`Force a project type for every config.`},{flags:`--language <language>`,description:`Config language: ts (default) | js.`},{flags:`--config-extension <ext>`,description:`Config extension: ts | mts | js | mjs | cjs (default inferred from the language and package type).`},{flags:`--skip-config`,description:`Only write .dbx/toolchain/projects.json; do not create dbx.config.* files.`},{flags:`--force`,description:`Overwrite configs that already exist.`},{flags:`--dry-run`,description:`Report what would be written without writing.`},{flags:`--json`,description:`Print the result as JSON.`}],run:async(n,r)=>{let i=n.cwd??r.cwd,a=T(n.language),o=E(n.configExtension),s=!!n.skipConfig;if(C(n)&&n.skipConfig===void 0&&n.language===void 0&&n.configExtension===void 0){let e=await _({message:`Create dbx.config.* files for projects missing one?`,initialValue:!0});if(v(e))return w();if(!e)s=!0;else{let e=await y({message:`Config language`,options:[{value:`ts`,label:`TypeScript`,hint:`dbx.config.ts`},{value:`js`,label:`JavaScript`,hint:`dbx.config.js / .mjs / .cjs`}]});if(v(e))return w();a=e}}let c=h({root:i,...n.include?{include:n.include}:{},...n.exclude?{exclude:n.exclude}:{},...n.type?{type:n.type}:{},force:!!n.force,dryRun:!!n.dryRun,...s?{skipConfig:!0}:{},...a?{language:a}:{},...o?{extension:o}:{}});if(n.json){t.raw(JSON.stringify(c,null,4));return}if(s){t.info(`wrote the project graph for ${c.configs.length} project(s); skipped config generation.`);return}let l=c.dryRun?`would create`:`created`;t.info(`${l} ${c.created.length} config(s), skipped ${c.skipped.length}.`);for(let n of c.configs){if(!n.created)continue;let r=e.basename(n.configPath);t.info(` + ${n.rel===`.`?r:`${n.rel}/${r}`} [${n.type}]`),n.removed&&t.info(` removed old ${e.basename(n.removed)}`),n.vite&&t.info(n.vite.folded?` vite: folded ${e.basename(n.vite.path)} into toolchain.vite (run \`dbx sync\`)`:` vite: left ${e.basename(n.vite.path)} alone (${n.vite.error})`)}}}]}export{P as projectCommands};
|
|
@@ -2,12 +2,12 @@ import __tsdown_shims_path from 'node:path';
|
|
|
2
2
|
import __tsdown_shims_url from 'node:url';
|
|
3
3
|
import { CATALOG_MARKER, CATALOG_PACKAGE_MANAGERS, Catalog, catalogFileFor, catalogsSyncTask, hasCatalog, renderPnpmWorkspace, renderYarnrc, supportsCatalogs } from "./catalogs.js";
|
|
4
4
|
import { projectCommands } from "./cli/index.js";
|
|
5
|
-
import { CONFIG_EXTENSIONS, ConfigExtension, ConfigLanguage, DEFAULT_CONFIG_EXTENSION, MonorepoRootContext, ProjectContext, RootOxcFiles, SCAFFOLD_CATALOG, WorkspaceContext, WriteGeneratedFilesOptions, configFileName, configLanguage, configUsesEsm, createMonorepoRootFiles, createRootProjectFiles, createWorkspaceFiles, findRootOxcFiles, isConfigExtension, renderApplicationEntry, renderApplicationHtml, renderGitignore, renderSourceEntry, renderSourceTest, renderToolchainConfig, renderWorkspaceTsconfig, resolveConfigExtension, upsertWorkspaceTsconfig, workspaceDirForTsconfig, writeGeneratedFiles } from "./typescript.js";
|
|
5
|
+
import { CONFIG_EXTENSIONS, ConfigExtension, ConfigLanguage, DEFAULT_CONFIG_EXTENSION, MonorepoRootContext, ProjectContext, RootOxcFiles, SCAFFOLD_CATALOG, WorkspaceContext, WriteGeneratedFilesOptions, configFileName, configLanguage, configUsesEsm, createMonorepoRootFiles, createRootProjectFiles, createWorkspaceFiles, findRootOxcFiles, isConfigExtension, renderApplicationEntry, renderApplicationHtml, renderGitignore, renderSourceEntry, renderSourceTest, renderToolchainConfig, renderWorkspaceTsconfig, resolveConfigExtension, scaffoldCatalog, upsertWorkspaceTsconfig, workspaceDirForTsconfig, writeGeneratedFiles } from "./typescript.js";
|
|
6
6
|
import { GENERATED_CONFIG_FILENAME, GenerateProjectConfigsOptions, GenerateProjectConfigsResult, GeneratedProjectConfig, generateProjectConfigs } from "./config.js";
|
|
7
7
|
import { projectSyncTask } from "./sync.js";
|
|
8
8
|
import { DEFAULT_PACKAGE_MANAGER_VERSIONS } from "../../shared/src/toolchain.js";
|
|
9
9
|
declare namespace index_d_exports {
|
|
10
|
-
export { CATALOG_MARKER, CATALOG_PACKAGE_MANAGERS, CONFIG_EXTENSIONS, Catalog, ConfigExtension, ConfigLanguage, DEFAULT_CONFIG_EXTENSION, DEFAULT_PACKAGE_MANAGER_VERSIONS, GENERATED_CONFIG_FILENAME, GenerateProjectConfigsOptions, GenerateProjectConfigsResult, GeneratedProjectConfig, MonorepoRootContext, ProjectContext, RootOxcFiles, SCAFFOLD_CATALOG, WorkspaceContext, WriteGeneratedFilesOptions, catalogFileFor, catalogsSyncTask, configFileName, configLanguage, configUsesEsm, createMonorepoRootFiles, createRootProjectFiles, createWorkspaceFiles, findRootOxcFiles, generateProjectConfigs, hasCatalog, isConfigExtension, projectCommands, projectSyncTask, renderApplicationEntry, renderApplicationHtml, renderGitignore, renderPnpmWorkspace, renderSourceEntry, renderSourceTest, renderToolchainConfig, renderWorkspaceTsconfig, renderYarnrc, resolveConfigExtension, supportsCatalogs, upsertWorkspaceTsconfig, workspaceDirForTsconfig, writeGeneratedFiles };
|
|
10
|
+
export { CATALOG_MARKER, CATALOG_PACKAGE_MANAGERS, CONFIG_EXTENSIONS, Catalog, ConfigExtension, ConfigLanguage, DEFAULT_CONFIG_EXTENSION, DEFAULT_PACKAGE_MANAGER_VERSIONS, GENERATED_CONFIG_FILENAME, GenerateProjectConfigsOptions, GenerateProjectConfigsResult, GeneratedProjectConfig, MonorepoRootContext, ProjectContext, RootOxcFiles, SCAFFOLD_CATALOG, WorkspaceContext, WriteGeneratedFilesOptions, catalogFileFor, catalogsSyncTask, configFileName, configLanguage, configUsesEsm, createMonorepoRootFiles, createRootProjectFiles, createWorkspaceFiles, findRootOxcFiles, generateProjectConfigs, hasCatalog, isConfigExtension, projectCommands, projectSyncTask, renderApplicationEntry, renderApplicationHtml, renderGitignore, renderPnpmWorkspace, renderSourceEntry, renderSourceTest, renderToolchainConfig, renderWorkspaceTsconfig, renderYarnrc, resolveConfigExtension, scaffoldCatalog, supportsCatalogs, upsertWorkspaceTsconfig, workspaceDirForTsconfig, writeGeneratedFiles };
|
|
11
11
|
}
|
|
12
12
|
//#endregion
|
|
13
|
-
export { CATALOG_MARKER, CATALOG_PACKAGE_MANAGERS, CONFIG_EXTENSIONS, Catalog, ConfigExtension, ConfigLanguage, DEFAULT_CONFIG_EXTENSION, DEFAULT_PACKAGE_MANAGER_VERSIONS, GENERATED_CONFIG_FILENAME, GenerateProjectConfigsOptions, GenerateProjectConfigsResult, GeneratedProjectConfig, MonorepoRootContext, ProjectContext, RootOxcFiles, SCAFFOLD_CATALOG, WorkspaceContext, WriteGeneratedFilesOptions, catalogFileFor, catalogsSyncTask, configFileName, configLanguage, configUsesEsm, createMonorepoRootFiles, createRootProjectFiles, createWorkspaceFiles, findRootOxcFiles, generateProjectConfigs, hasCatalog, index_d_exports, isConfigExtension, projectCommands, projectSyncTask, renderApplicationEntry, renderApplicationHtml, renderGitignore, renderPnpmWorkspace, renderSourceEntry, renderSourceTest, renderToolchainConfig, renderWorkspaceTsconfig, renderYarnrc, resolveConfigExtension, supportsCatalogs, upsertWorkspaceTsconfig, workspaceDirForTsconfig, writeGeneratedFiles };
|
|
13
|
+
export { CATALOG_MARKER, CATALOG_PACKAGE_MANAGERS, CONFIG_EXTENSIONS, Catalog, ConfigExtension, ConfigLanguage, DEFAULT_CONFIG_EXTENSION, DEFAULT_PACKAGE_MANAGER_VERSIONS, GENERATED_CONFIG_FILENAME, GenerateProjectConfigsOptions, GenerateProjectConfigsResult, GeneratedProjectConfig, MonorepoRootContext, ProjectContext, RootOxcFiles, SCAFFOLD_CATALOG, WorkspaceContext, WriteGeneratedFilesOptions, catalogFileFor, catalogsSyncTask, configFileName, configLanguage, configUsesEsm, createMonorepoRootFiles, createRootProjectFiles, createWorkspaceFiles, findRootOxcFiles, generateProjectConfigs, hasCatalog, index_d_exports, isConfigExtension, projectCommands, projectSyncTask, renderApplicationEntry, renderApplicationHtml, renderGitignore, renderPnpmWorkspace, renderSourceEntry, renderSourceTest, renderToolchainConfig, renderWorkspaceTsconfig, renderYarnrc, resolveConfigExtension, scaffoldCatalog, supportsCatalogs, upsertWorkspaceTsconfig, workspaceDirForTsconfig, writeGeneratedFiles };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"node:path";import"node:url";import.meta.url;import{__exportAll as e}from"../../../_virtual/_rolldown/runtime.js";import{DEFAULT_PACKAGE_MANAGER_VERSIONS as t}from"../../shared/src/toolchain.js";import{CATALOG_MARKER as n,CATALOG_PACKAGE_MANAGERS as r,catalogFileFor as i,catalogsSyncTask as a,hasCatalog as o,renderPnpmWorkspace as s,renderYarnrc as c,supportsCatalogs as l}from"./catalogs.js";import{CONFIG_EXTENSIONS as u,DEFAULT_CONFIG_EXTENSION as d,SCAFFOLD_CATALOG as f,configFileName as p,configLanguage as m,configUsesEsm as h,createMonorepoRootFiles as g,createRootProjectFiles as _,createWorkspaceFiles as v,findRootOxcFiles as y,isConfigExtension as b,renderApplicationEntry as x,renderApplicationHtml as S,renderGitignore as C,renderSourceEntry as w,renderSourceTest as T,renderToolchainConfig as E,renderWorkspaceTsconfig as D,resolveConfigExtension as O,
|
|
1
|
+
import"node:path";import"node:url";import.meta.url;import{__exportAll as e}from"../../../_virtual/_rolldown/runtime.js";import{DEFAULT_PACKAGE_MANAGER_VERSIONS as t}from"../../shared/src/toolchain.js";import{CATALOG_MARKER as n,CATALOG_PACKAGE_MANAGERS as r,catalogFileFor as i,catalogsSyncTask as a,hasCatalog as o,renderPnpmWorkspace as s,renderYarnrc as c,supportsCatalogs as l}from"./catalogs.js";import{CONFIG_EXTENSIONS as u,DEFAULT_CONFIG_EXTENSION as d,SCAFFOLD_CATALOG as f,configFileName as p,configLanguage as m,configUsesEsm as h,createMonorepoRootFiles as g,createRootProjectFiles as _,createWorkspaceFiles as v,findRootOxcFiles as y,isConfigExtension as b,renderApplicationEntry as x,renderApplicationHtml as S,renderGitignore as C,renderSourceEntry as w,renderSourceTest as T,renderToolchainConfig as E,renderWorkspaceTsconfig as D,resolveConfigExtension as O,scaffoldCatalog as k,upsertWorkspaceTsconfig as A,workspaceDirForTsconfig as j,writeGeneratedFiles as M}from"./typescript.js";import{GENERATED_CONFIG_FILENAME as N,generateProjectConfigs as P}from"./config.js";import{projectCommands as F}from"./cli/index.js";import{projectSyncTask as I}from"./sync.js";var L=/* @__PURE__ */ e({CATALOG_MARKER:()=>n,CATALOG_PACKAGE_MANAGERS:()=>r,CONFIG_EXTENSIONS:()=>u,DEFAULT_CONFIG_EXTENSION:()=>`ts`,DEFAULT_PACKAGE_MANAGER_VERSIONS:()=>t,GENERATED_CONFIG_FILENAME:()=>N,SCAFFOLD_CATALOG:()=>f,catalogFileFor:()=>i,catalogsSyncTask:()=>a,configFileName:()=>p,configLanguage:()=>m,configUsesEsm:()=>h,createMonorepoRootFiles:()=>g,createRootProjectFiles:()=>_,createWorkspaceFiles:()=>v,findRootOxcFiles:()=>y,generateProjectConfigs:()=>P,hasCatalog:()=>o,isConfigExtension:()=>b,projectCommands:()=>F,projectSyncTask:()=>I,renderApplicationEntry:()=>x,renderApplicationHtml:()=>S,renderGitignore:()=>C,renderPnpmWorkspace:()=>s,renderSourceEntry:()=>w,renderSourceTest:()=>T,renderToolchainConfig:()=>E,renderWorkspaceTsconfig:()=>D,renderYarnrc:()=>c,resolveConfigExtension:()=>O,scaffoldCatalog:()=>k,supportsCatalogs:()=>l,upsertWorkspaceTsconfig:()=>A,workspaceDirForTsconfig:()=>j,writeGeneratedFiles:()=>M});export{n as CATALOG_MARKER,r as CATALOG_PACKAGE_MANAGERS,u as CONFIG_EXTENSIONS,d as DEFAULT_CONFIG_EXTENSION,t as DEFAULT_PACKAGE_MANAGER_VERSIONS,N as GENERATED_CONFIG_FILENAME,f as SCAFFOLD_CATALOG,i as catalogFileFor,a as catalogsSyncTask,p as configFileName,m as configLanguage,h as configUsesEsm,g as createMonorepoRootFiles,_ as createRootProjectFiles,v as createWorkspaceFiles,y as findRootOxcFiles,P as generateProjectConfigs,o as hasCatalog,b as isConfigExtension,F as projectCommands,I as projectSyncTask,x as renderApplicationEntry,S as renderApplicationHtml,C as renderGitignore,s as renderPnpmWorkspace,w as renderSourceEntry,T as renderSourceTest,E as renderToolchainConfig,D as renderWorkspaceTsconfig,c as renderYarnrc,O as resolveConfigExtension,k as scaffoldCatalog,L as src_exports,l as supportsCatalogs,A as upsertWorkspaceTsconfig,j as workspaceDirForTsconfig,M as writeGeneratedFiles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"node:path";import"node:url";import.meta.url;import{readJsonAt as t}from"../../shared/src/fs-utils.js";import{projectToPackageJson as n,splitPackageName as r}from"../../shared/src/project.js";import"../../shared/src/index.js";import
|
|
1
|
+
import{default as e}from"node:path";import"node:url";import.meta.url;import{readJsonAt as t}from"../../shared/src/fs-utils.js";import{projectToPackageJson as n,splitPackageName as r}from"../../shared/src/project.js";import{CONFIG_FILE_NAMES as i}from"../../shared/src/toolchain.js";import"../../shared/src/index.js";import a from"node:fs";function o(t){let n=e.resolve(t);for(;;){if(a.existsSync(e.join(n,`.git`)))return n;let t=e.dirname(n);if(t===n)return;n=t}}function s(t){let n=e.dirname(e.resolve(t));for(;;){if(i.some(t=>a.existsSync(e.join(n,t))))return n;let t=e.dirname(n);if(t===n)return;n=t}}function c(e){return o(e)??s(e)}function l(){return{name:`project`,enabled:e=>e.project!==void 0,run:i=>{let a=i.config.project;if(!a)return[];let o=t(i.cwd,`package.json`);if(!o)return[];let s=c(i.cwd),l=s&&e.resolve(s)!==e.resolve(i.cwd)?e.relative(s,i.cwd).replace(/\\/g,`/`):void 0,u={...a};if(u.name!==void 0&&u.scope===void 0&&o.name){let{scope:e}=r(o.name);e&&(u.scope=e)}let d=n(u,l?{directory:l}:{});if(Object.keys(d).length===0)return[];let f={...o,...d};return[{path:`package.json`,content:`${JSON.stringify(f,null,4)}\n`,track:!1}]}}}export{l as projectSyncTask};
|
|
@@ -9,6 +9,12 @@ import "../../shared/src/index.js";
|
|
|
9
9
|
//#region packages/project/src/typescript.d.ts
|
|
10
10
|
/** The catalog a scaffolded root writes into its package-manager file. */
|
|
11
11
|
export declare const SCAFFOLD_CATALOG: Record<string, string>;
|
|
12
|
+
/**
|
|
13
|
+
* The catalog a scaffold writes for a package manager. `undefined` when the
|
|
14
|
+
* manager has no catalog file: npm has no catalog support, and Bun's lives in
|
|
15
|
+
* `package.json` `workspaces.catalog` (handled by {@link workspacesField}).
|
|
16
|
+
*/
|
|
17
|
+
export declare function scaffoldCatalog(packageManager: string | undefined, exclude?: string[]): Record<string, string> | undefined;
|
|
12
18
|
/** The replacement values a project scaffold understands. */
|
|
13
19
|
export interface ProjectContext {
|
|
14
20
|
/** The project/package name (unscoped). */
|
|
@@ -58,12 +64,12 @@ export interface RootOxcFiles {
|
|
|
58
64
|
}
|
|
59
65
|
/** The language a generated `dbx.config.*` uses. */
|
|
60
66
|
export type ConfigLanguage = 'ts' | 'js';
|
|
61
|
-
/** The extensions a generated `dbx.config.*` can use. */
|
|
62
|
-
export type ConfigExtension = 'ts' | 'mts' | 'js' | 'mjs' | 'cjs';
|
|
63
67
|
/** Every supported generated config extension. */
|
|
64
|
-
export declare const CONFIG_EXTENSIONS: readonly
|
|
68
|
+
export declare const CONFIG_EXTENSIONS: readonly ['ts', 'mts', 'js', 'mjs', 'cjs'];
|
|
69
|
+
/** The extensions a generated `dbx.config.*` can use. */
|
|
70
|
+
export type ConfigExtension = (typeof CONFIG_EXTENSIONS)[number];
|
|
65
71
|
/** The default generated config extension. */
|
|
66
|
-
export declare const DEFAULT_CONFIG_EXTENSION:
|
|
72
|
+
export declare const DEFAULT_CONFIG_EXTENSION: 'ts';
|
|
67
73
|
/** Whether a string is a supported generated config extension. */
|
|
68
74
|
export declare function isConfigExtension(value: string): value is ConfigExtension;
|
|
69
75
|
/** The generated config file name for an extension. */
|
|
@@ -101,6 +107,8 @@ export declare function renderToolchainConfig(ctx: ProjectContext & {
|
|
|
101
107
|
type: ProjectType;
|
|
102
108
|
fmtOxc?: boolean;
|
|
103
109
|
lintOxc?: boolean;
|
|
110
|
+
/** The catalog the scaffold writes (`toolchain.catalogs.packages`). */
|
|
111
|
+
catalogs?: Record<string, string>;
|
|
104
112
|
/** The generated file extension (default `ts`). */
|
|
105
113
|
configExtension?: ConfigExtension;
|
|
106
114
|
/** The package's `type` (`module`/`commonjs`), used for `.js` syntax. */
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import{default as e}from"node:path";import"node:url";import.meta.url;import{projectToPackageJson as t}from"../../shared/src/project.js";import{DEFAULT_PACKAGE_MANAGER_VERSIONS as n}from"../../shared/src/toolchain.js";import{DEFAULT_FMT_RULES as
|
|
2
|
-
`)}function
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function
|
|
5
|
-
`)}function
|
|
6
|
-
`),s=e.fmtOxc??e.oxc===!0,c=e.lintOxc??e.oxc===!0,l=
|
|
1
|
+
import{default as e}from"node:path";import"node:url";import.meta.url;import{projectToPackageJson as t}from"../../shared/src/project.js";import{DEFAULT_PACKAGE_MANAGER_VERSIONS as n,defaultPackageManagerVersion as r}from"../../shared/src/toolchain.js";import{DEFAULT_FMT_RULES as i,DEFAULT_LINT_RULES as a}from"../../shared/src/vite-defaults.js";import"../../shared/src/index.js";import{renderPnpmWorkspace as o,renderYarnrc as s,supportsCatalogs as c}from"./catalogs.js";import{parseTsconfig as l}from"../../tsconfig/src/resolve.js";import{renderMonorepoTsconfig as u,renderTsconfigBase as d,renderTsconfigBuild as f,renderTsconfigDefault as p}from"../../tsconfig/src/templates.js";import"../../tsconfig/src/index.js";import{version as m}from"../../../package.js";import h from"node:fs";import{applyEdits as g,modify as _}from"jsonc-parser";const v={"@deltabox/toolchain":`^${m}`,"@types/node":`^22.10.2`,tsdown:`^0.23.0`,typescript:`^6.0.3`,vite:`^8.3.0`,"vite-plus":`^1.2.0`,vitest:`^5.0.0`},y=v;function b(e,t){if(!e)return;let n=t??r(e);return n?`${e}@${n}`:e}function x(e,t,n=[]){let r=Object.entries(v).filter(([e])=>!n.includes(e));return Object.fromEntries(t?r.map(([e])=>[e,`catalog:`]):r)}function S(e,t){let n=e??`yarn`;return c(n)?n!==`bun`||t:!1}function C(e,t=[]){let n=e??`yarn`;if(n===`yarn`||n===`pnpm`)return Object.fromEntries(Object.entries(v).filter(([e])=>!t.includes(e)))}function w(e,t,n=[]){let r=C(e,n);if(!r)return[];switch(e??`yarn`){case`yarn`:return[{path:`.yarnrc.yml`,content:s({packages:r})}];case`pnpm`:return[{path:`pnpm-workspace.yaml`,content:o({packages:r},t?[`packages/*`]:void 0)}];default:return[]}}function T(e,t){return(e??`yarn`)===`bun`?{packages:t,catalog:v}:t}const E=[`ts`,`mts`,`js`,`mjs`,`cjs`],ee=`ts`;function D(e){return E.includes(e)}function O(e=`ts`){return`dbx.config.${e}`}function k(e){return e===`ts`||e===`mts`?`ts`:`js`}function A(e,t,n){return n||(e===`ts`?`ts`:t===`module`?`mjs`:t===`commonjs`?`cjs`:`js`)}function j(e,t){return e===`cjs`?!1:e===`mjs`||e===`mts`||e!==`js`||t===`module`}function M(t){let n=e.resolve(t);if(h.existsSync(e.join(n,`.git`)))return{fmt:!1,lint:!1};let r=e.dirname(n);for(;;){let t=h.existsSync(e.join(r,`.oxfmtrc.json`)),n=h.existsSync(e.join(r,`.oxlintrc.json`));if(t||n)return{fmt:t,lint:n};if(h.existsSync(e.join(r,`.git`)))break;let i=e.dirname(r);if(i===r)break;r=i}return{fmt:!1,lint:!1}}function N(e){let{tsconfigExtends:t,rootOxc:n,...r}=e;return r}function P(e){let n=e.repo??e.repoUrl;return t({...e.description?{description:e.description}:{},...e.author?{author:e.author}:{},...e.license?{license:e.license}:{},...e.homepage?{homepage:e.homepage}:{},...n?{repo:n}:{}})}const F=(e,t=4)=>`${JSON.stringify(e,null,t)}\n`;function I(e){return`'${e.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`).replace(/[\u0000-\u001f\u007f\u2028\u2029]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`)}'`}function L(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}const R=`./node_modules/oxfmt/configuration_schema.json`,z=`./node_modules/oxlint/configuration_schema.json`;function B(e,t){return`${JSON.stringify({$schema:e,...t},null,4)}\n`}function V(){return[`export function greet(who = 'world'): string {`," return `Hello, ${who}!`;",`}`,``].join(`
|
|
2
|
+
`)}function H(){return[`import { greet } from './index.js';`,``,`const app = document.querySelector<HTMLDivElement>('#app');`,`if (app) app.textContent = greet('world');`,``].join(`
|
|
3
|
+
`)}function U(e){return[`<!doctype html>`,`<html lang="en">`,` <head>`,` <meta charset="UTF-8" />`,` <meta name="viewport" content="width=device-width, initial-scale=1.0" />`,` <title>${L(e)}</title>`,` </head>`,` <body>`,` <div id="app"></div>`,` <script type="module" src="/src/main.ts"><\/script>`,` </body>`,`</html>`,``].join(`
|
|
4
|
+
`)}function W(){return[`import { describe, expect, it } from 'vitest';`,``,`import { greet } from '../src/index.js';`,``,`describe('greet', () => {`,` it('greets the world by default', () => {`,` expect(greet()).toBe('Hello, world!');`,` });`,`});`,``].join(`
|
|
5
|
+
`)}function G(e){let t=[[`type`,e.type],[`name`,e.name]];e.scope&&t.push([`scope`,e.scope]),e.description&&t.push([`description`,e.description]),e.author&&t.push([`author`,e.author]),e.license&&t.push([`license`,e.license]),e.homepage&&t.push([`homepage`,e.homepage]);let n=e.repo??e.repoUrl;n&&t.push([`repo`,n]),t.push([`nodeVersion`,e.nodeVersion??`22`]);let i=e.packageManager??`yarn`;t.push([`packageManager`,i]);let a=e.packageManagerVersion??e.yarnVersion??r(i);a&&t.push([`packageManagerVersion`,a]);let o=t.map(([e,t])=>` ${e}: ${I(t)},`).join(`
|
|
6
|
+
`),s=e.fmtOxc??e.oxc===!0,c=e.lintOxc??e.oxc===!0,l=e.catalogs?` catalogs: {\n packages: {\n${Object.entries(e.catalogs).map(([e,t])=>` ${I(e)}: ${I(t)},`).join(`
|
|
7
|
+
`)}\n },\n },`:void 0,u=[` project: {\n${o}\n },`,...l?[l]:[],...s?[` fmt: { oxc: true },`]:[],...c?[` lint: { oxc: true },`]:[]];return j(e.configExtension??`ts`,e.packageType)?`import { defineConfig } from '@deltabox/toolchain';
|
|
7
8
|
|
|
8
9
|
export default defineConfig({
|
|
9
10
|
toolchain: {
|
|
10
|
-
${
|
|
11
|
+
${u.join(`
|
|
11
12
|
`)}
|
|
12
13
|
},
|
|
13
14
|
});
|
|
14
15
|
`:`/** @type {import('@deltabox/toolchain').DbxConfig} */
|
|
15
16
|
module.exports = {
|
|
16
17
|
toolchain: {
|
|
17
|
-
${
|
|
18
|
+
${u.join(`
|
|
18
19
|
`)}
|
|
19
20
|
},
|
|
20
21
|
};
|
|
21
|
-
`}function
|
|
22
|
+
`}function K(e=!1,t=`./tsconfig.default.json`){return F({...t===!1?{}:{extends:t},compilerOptions:{composite:e}})}function q(e){let t=e.kind===`application`,n=e.oxc!==!1&&e.includeConfig!==!1,r=n&&e.rootOxc?.fmt!==!0,o=n&&e.rootOxc?.lint!==!0,s=C(e.packageManager,t?[`tsdown`]:[]),c={name:e.scope?`${e.scope}/${e.name}`:e.name,version:`0.1.0`,private:!0,type:`module`,...P(e),scripts:t?{dev:`vite`,build:`vite build`,preview:`vite preview`,format:`dbx fmt`,lint:`dbx lint --fix`,test:`vitest run`,typecheck:`tsc -p tsconfig.json --noEmit`}:{build:`tsdown`,format:`dbx fmt`,lint:`dbx lint --fix`,test:`vitest run`,typecheck:`tsc -p tsconfig.json --noEmit`},devDependencies:x(e.packageManager,S(e.packageManager,!1),t?[`tsdown`]:[]),...b(e.packageManager,e.packageManagerVersion??e.yarnVersion)?{packageManager:b(e.packageManager,e.packageManagerVersion??e.yarnVersion)}:{},engines:{node:e.nodeVersion?`>=${e.nodeVersion}`:`>=22`}};return[...e.includeConfig===!1?[]:[{path:`dbx.config.ts`,content:G({...e,type:e.type??`project`,fmtOxc:r,lintOxc:o,...s?{catalogs:s}:{}})}],{path:`package.json`,content:F(c)},...t?[{path:`index.html`,content:U(e.name)},{path:`src/main.ts`,content:H()}]:[],{path:`src/index.ts`,content:V()},{path:`tests/index.test.ts`,content:W()},{path:`tsconfig.base.json`,content:d(N(e),e.tsconfigExtends?.base)},{path:`tsconfig.default.json`,content:p(N(e),e.tsconfigExtends?.default)},{path:`tsconfig.build.json`,content:f(N(e),e.tsconfigExtends?.build)},{path:`tsconfig.json`,content:K()},...r?[{path:`.oxfmtrc.json`,content:B(R,i)}]:[],...o?[{path:`.oxlintrc.json`,content:B(z,a)}]:[],{path:`.gitignore`,content:$()},{path:`README.md`,content:`# ${e.name}\n`},...w(e.packageManager,!1,t?[`tsdown`]:[])]}function J(e){let t=e.oxc!==!1&&e.includeConfig!==!1,n=C(e.packageManager),r={name:e.name,version:`0.1.0`,private:!0,type:`module`,...P(e),scripts:{build:`dbx run --filter "./packages/*" build`,test:`dbx run --filter "./packages/*" test`,typecheck:`dbx run --filter "./packages/*" typecheck`,format:`dbx fmt`,lint:`dbx lint --fix`},workspaces:T(e.packageManager,e.workspaceGlobs??[`packages/*`]),devDependencies:x(e.packageManager,S(e.packageManager,!0)),...b(e.packageManager,e.packageManagerVersion??e.yarnVersion)?{packageManager:b(e.packageManager,e.packageManagerVersion??e.yarnVersion)}:{},engines:{node:e.nodeVersion?`>=${e.nodeVersion}`:`>=22`}};return[...e.includeConfig===!1?[]:[{path:`dbx.config.ts`,content:G({...e,type:e.type??`monorepo-root`,oxc:t,...n?{catalogs:n}:{}})}],{path:`package.json`,content:F(r)},{path:`tsconfig.base.json`,content:d(N(e),e.tsconfigExtends?.base)},{path:`tsconfig.workspaces.json`,content:u({scope:e.scope??e.name,workspaces:e.workspaces})},{path:`tsconfig.json`,content:F({extends:`./tsconfig.workspaces.json`,compilerOptions:{composite:!1},files:[]})},...t?[{path:`.oxfmtrc.json`,content:B(R,i)},{path:`.oxlintrc.json`,content:B(z,a)}]:[],{path:`.gitignore`,content:$()},{path:`README.md`,content:`# ${e.name}\n`},...w(e.packageManager,!0)]}function Y(t){let n=t.replace(/\\/g,`/`).replace(/^\.?\//,``).replace(/\/+$/,``);if(!n||n===`.`||e.isAbsolute(t)||/^[a-zA-Z]:/.test(t)||n.split(`/`).includes(`..`))throw Error(`invalid workspace directory "${t}" (must be relative to the root).`);return n}function X(e){let t=e.match(/^([ \t]+)\S/m)?.[1]??` `,n=!t.includes(` `);return{insertSpaces:n,tabSize:n?t.length:1}}function Z(t,n,r,i=`tsconfig.workspaces.json`){let a=Y(n.dir),o=e.resolve(t,i);if(!h.existsSync(o))return!1;let s=h.readFileSync(o,`utf-8`),c;try{c=l(s)}catch{return!1}let u=Array.isArray(c.references)?c.references:void 0,d=c.compilerOptions&&typeof c.compilerOptions==`object`?c.compilerOptions:{},f=/* @__PURE__ */ new Set,p=/* @__PURE__ */ new Map;if(r){let e=d.paths&&typeof d.paths==`object`?d.paths:{};for(let t of[`${r}/${n.alias}`,`${r}/${n.alias}/*`]){let n=e[t],r=Array.isArray(n)?n[0]:void 0,i=typeof r==`string`?r.match(/^\.\/(.+)\/src\/(?:index\.ts|\*)$/):void 0;i?.[1]&&f.add(i[1]);let o=[t.endsWith(`/*`)?`./${a}/src/*`:`./${a}/src/index.ts`];e[t]=o,p.set(t,o)}d.paths=e}c.compilerOptions=d;let m=`./${a}/tsconfig.json`,v=new Set([...f].filter(e=>e!==a).map(e=>`./${e}/tsconfig.json`)),y=(Array.isArray(c.references)?c.references:[]).filter(e=>!v.has(e.path));y.some(e=>e.path===m)||y.push({path:m}),c.references=y;try{let e=X(s),t=s;for(let[n,r]of p)t=g(t,_(t,[`compilerOptions`,`paths`,n],r,{formattingOptions:e}));let n=u??[],r=n.findIndex(e=>e.path===m),i=n.map((e,t)=>typeof e.path==`string`&&v.has(e.path)?t:-1).filter(e=>e>=0);if(i.length>0){r===-1&&(t=g(t,_(t,[`references`,i[0],`path`],m,{formattingOptions:e})));for(let n of i.filter((e,t)=>r!==-1||t>0).sort((e,t)=>t-e))t=g(t,_(t,[`references`,n],void 0,{formattingOptions:e}))}else r===-1&&(t=u===void 0?g(t,_(t,[`references`],[{path:m}],{formattingOptions:e})):g(t,_(t,[`references`,n.length],{path:m},{formattingOptions:e})));h.writeFileSync(o,t,`utf-8`)}catch{h.writeFileSync(o,`${JSON.stringify(c,null,4)}\n`,`utf-8`)}return!0}function Q(e){let t=e.useCatalog===!0&&S(e.packageManager,!0)?x(e.packageManager,!0):{...v},n={name:e.scope?`${e.scope}/${e.wsName}`:e.wsName,version:`0.1.0`,type:`module`,...P(e),main:`./dist/index.js`,module:`./dist/index.js`,types:`./dist/index.d.ts`,exports:{".":{types:`./dist/index.d.ts`,import:`./dist/index.js`},"./package.json":`./package.json`},sideEffects:!1,files:[`dist`],scripts:{build:`tsdown`,format:`dbx fmt`,lint:`dbx lint --fix`,test:`vitest run`,typecheck:`tsc -p tsconfig.build.json --noEmit`},devDependencies:t,...e.nodeVersion?{engines:{node:`>=${e.nodeVersion}`}}:{},publishConfig:{access:`public`,provenance:!0}},r=e.wsDir.split(`/`).length;return[...e.includeConfig===!1?[]:[{path:`dbx.config.ts`,content:G({...e,name:e.wsName,type:e.type??`monorepo-workspace`})}],{path:`package.json`,content:F(n)},{path:`src/index.ts`,content:V()},{path:`tests/index.test.ts`,content:W()},{path:`tsconfig.default.json`,content:F({...e.tsconfigExtends?.default===!1?{}:{extends:e.tsconfigExtends?.default??`${`../`.repeat(r)}tsconfig.base.json`},compilerOptions:{module:`NodeNext`,moduleResolution:`NodeNext`,types:[`node`]},include:[`src`,`tests`,`tsdown.config.ts`,`vitest.config.ts`]})},{path:`tsconfig.build.json`,content:K(!1,e.tsconfigExtends?.build)},{path:`tsconfig.json`,content:K()},{path:`tsdown.config.ts`,content:`import { defineConfig } from 'tsdown';
|
|
22
23
|
|
|
23
24
|
import { baseTsdownConfig } from '@deltabox/toolchain/tsdown';
|
|
24
25
|
|
|
@@ -28,5 +29,5 @@ export default defineConfig({
|
|
|
28
29
|
// Keep the explicit package.json exports (types + import conditions).
|
|
29
30
|
exports: false,
|
|
30
31
|
});
|
|
31
|
-
`}]}function
|
|
32
|
-
`)}function
|
|
32
|
+
`}]}function $(){return(/* @__PURE__ */ `node_modules/,dist/,coverage/,.vite/,*.tsbuildinfo,,.env,.env.*,!.env.example,!.env.example.*,,.DS_Store,,# Toolchain state; only the manifest is committed,.dbx/toolchain/*,!.dbx/toolchain/manifest.json,,# Yarn 4,.pnp.*,.yarn/*,!.yarn/patches,!.yarn/plugins,!.yarn/releases,!.yarn/sdks,!.yarn/versions,`.split(`,`)).join(`
|
|
33
|
+
`)}function te(t,n){let r=process.platform===`win32`?t.toLowerCase():t,i=process.platform===`win32`?n.toLowerCase():n;return i===r||i.startsWith(`${r}${e.sep}`)}function ne(t,n=process.cwd(),r={}){let i=e.resolve(n),a=t.map(t=>e.resolve(i,t.path)),o=/* @__PURE__ */ new Map;for(let t of a){if(!te(i,t))throw Error(`refusing to write outside ${i}: ${t}`);let n=process.platform===`win32`?t.toLowerCase():t,r=o.get(n);if(r!==void 0)throw Error(`refusing to write duplicate file(s): ${r} and ${e.relative(i,t)}`);o.set(n,e.relative(i,t))}if(r.force!==!0){let t=a.filter(e=>h.existsSync(e));if(t.length>0)throw Error(`refusing to overwrite existing file(s): ${t.map(t=>e.relative(i,t)).join(`, `)} (use --force to overwrite).`)}let s=[];for(let[n,r]of a.entries())h.mkdirSync(e.dirname(r),{recursive:!0}),h.writeFileSync(r,t[n].content,`utf-8`),s.push(r);return s}export{E as CONFIG_EXTENSIONS,ee as DEFAULT_CONFIG_EXTENSION,n as DEFAULT_PACKAGE_MANAGER_VERSIONS,y as SCAFFOLD_CATALOG,O as configFileName,k as configLanguage,j as configUsesEsm,J as createMonorepoRootFiles,q as createRootProjectFiles,Q as createWorkspaceFiles,M as findRootOxcFiles,D as isConfigExtension,H as renderApplicationEntry,U as renderApplicationHtml,$ as renderGitignore,V as renderSourceEntry,W as renderSourceTest,G as renderToolchainConfig,K as renderWorkspaceTsconfig,A as resolveConfigExtension,C as scaffoldCatalog,Z as upsertWorkspaceTsconfig,Y as workspaceDirForTsconfig,ne as writeGeneratedFiles};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region packages/shared/src/config-schema/alias-rewrite.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* URL-rewrite-style rewriting for auto-wired tsconfig alias keys.
|
|
6
|
+
*
|
|
7
|
+
* `rewriteAlias` only touches the `paths` keys that auto-wiring generated; any
|
|
8
|
+
* key you wrote yourself is preserved. A pattern is matched against a generated
|
|
9
|
+
* alias key and the replacement is applied with `String.prototype.replace`, so
|
|
10
|
+
* `$1`, `$2`, ... (and `$&`) work as capture-group references.
|
|
11
|
+
*
|
|
12
|
+
* A string pattern is a regular-expression source (use `^`/`$` for whole-key
|
|
13
|
+
* matches), a `RegExp` is used as-is, and an array of patterns tries each one in
|
|
14
|
+
* order until one matches. When `rewriteAlias` is an array of rules, the rules
|
|
15
|
+
* are applied in order and the first matching rule wins.
|
|
16
|
+
*/
|
|
17
|
+
/** One pattern (or list of patterns) an alias rewrite can match. */
|
|
18
|
+
export type ToolchainTsconfigAliasRewriteKey = string | RegExp | Array<string | RegExp>;
|
|
19
|
+
/** A single ordered alias rewrite rule. */
|
|
20
|
+
export interface ToolchainTsconfigAliasRewriteRule {
|
|
21
|
+
/** Pattern(s) matched against generated alias keys. */
|
|
22
|
+
pattern: ToolchainTsconfigAliasRewriteKey;
|
|
23
|
+
/** Replacement for the matched key (`$1`, `$2`, ... refer to capture groups). */
|
|
24
|
+
replacement: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Auto-alias rewrite: either a `Record<string, string>` map of string patterns
|
|
28
|
+
* to replacements, or an ordered array of {@link ToolchainTsconfigAliasRewriteRule}
|
|
29
|
+
* (which additionally accepts `RegExp` patterns and arrays of patterns).
|
|
30
|
+
*/
|
|
31
|
+
export type ToolchainTsconfigAliasRewrite = Record<string, string> | ToolchainTsconfigAliasRewriteRule[];
|
|
32
|
+
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"node:path";import"node:url";import.meta.url;import{externalConfigSchema as e}from"./external.js";import{withEnabled as t}from"./meta.js";import{z as n}from"zod";const r=e(`Biome configuration options.`,`BiomeConfig`),i=t(n.object({vscode:n.boolean().describe(`Write the Biome VS Code settings (default true).`).optional(),overrides:r.describe("Deep-merged over the generated `biome.json` (arrays union).").optional()})).describe("Biome config generation (for consumers that still want a `biome.json`).").meta({id:`ToolchainBiomeConfig`,deprecated:!0,deprecationMessage:"use `toolchain.fmt.biome` / `toolchain.lint.biome`. Still writes `biome.json`."});export{r as biomeConfigOptionsSchema,i as biomeConfigSchema};
|
|
1
|
+
import"node:path";import"node:url";import.meta.url;import{externalConfigSchema as e}from"./external.js";import{withEnabled as t}from"./meta.js";import{z as n}from"zod";const r=e(`Biome configuration options.`,`BiomeConfig`),i=t(n.object({vscode:n.boolean().describe(`Write the Biome VS Code settings (default true).`).optional(),overrides:r.describe("Deep-merged over the generated `biome.json` (arrays union; `$remove:`/`$reset` prune or replace them).").optional()})).describe("Biome config generation (for consumers that still want a `biome.json`).").meta({id:`ToolchainBiomeConfig`,deprecated:!0,deprecationMessage:"use `toolchain.fmt.biome` / `toolchain.lint.biome`. Still writes `biome.json`."});export{r as biomeConfigOptionsSchema,i as biomeConfigSchema};
|