@visulima/package 1.8.1 → 1.8.3
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 +27 -0
- package/LICENSE.md +17 -0
- package/dist/error.cjs +1 -14
- package/dist/error.d.mts +9 -0
- package/dist/error.mjs +1 -0
- package/dist/index.cjs +1 -156
- package/dist/index.d.cts +2 -3
- package/dist/index.d.mts +18 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.mjs +1 -0
- package/dist/monorepo.cjs +1 -14
- package/dist/monorepo.d.mts +8 -0
- package/dist/monorepo.mjs +1 -0
- package/dist/package-json.cjs +1 -28
- package/dist/package-json.d.cts +3 -5
- package/dist/package-json.d.mts +22 -0
- package/dist/package-json.d.ts +3 -5
- package/dist/package-json.mjs +1 -0
- package/dist/package-manager.cjs +1 -33
- package/dist/package-manager.d.mts +16 -0
- package/dist/package-manager.mjs +1 -0
- package/dist/package.cjs +1 -18
- package/dist/package.d.mts +4 -0
- package/dist/package.mjs +1 -0
- package/dist/shared/package.DipMHw9r.cjs +1 -0
- package/dist/shared/package.DvbNGF15.mjs +1 -0
- package/dist/shared/package.SZmjOQBM.d.cts +2076 -0
- package/dist/shared/package.SZmjOQBM.d.mts +2076 -0
- package/dist/shared/package.SZmjOQBM.d.ts +2076 -0
- package/dist/shared/package.Xn4v2Y_g.cjs +1 -0
- package/dist/shared/package.zhGeUcxO.mjs +1 -0
- package/dist/tsconfig/index.cjs +1 -0
- package/dist/tsconfig/index.d.cts +34 -0
- package/dist/tsconfig/index.d.mts +34 -0
- package/dist/tsconfig/index.d.ts +34 -0
- package/dist/tsconfig/index.mjs +1 -0
- package/package.json +32 -40
- package/dist/chunk-5VO6NTKJ.js +0 -361
- package/dist/chunk-5VO6NTKJ.js.map +0 -1
- package/dist/chunk-7IOK6YPW.cjs +0 -52
- package/dist/chunk-7IOK6YPW.cjs.map +0 -1
- package/dist/chunk-CVVFWSMT.cjs +0 -65
- package/dist/chunk-CVVFWSMT.cjs.map +0 -1
- package/dist/chunk-E2PKJX3Q.js +0 -54
- package/dist/chunk-E2PKJX3Q.js.map +0 -1
- package/dist/chunk-EYMR7Z2I.js +0 -62
- package/dist/chunk-EYMR7Z2I.js.map +0 -1
- package/dist/chunk-G3SI24AJ.cjs +0 -88
- package/dist/chunk-G3SI24AJ.cjs.map +0 -1
- package/dist/chunk-IIYQBLPC.js +0 -119
- package/dist/chunk-IIYQBLPC.js.map +0 -1
- package/dist/chunk-IK5YSYLX.cjs +0 -126
- package/dist/chunk-IK5YSYLX.cjs.map +0 -1
- package/dist/chunk-UZ2FN6C5.js +0 -78
- package/dist/chunk-UZ2FN6C5.js.map +0 -1
- package/dist/chunk-WXFZK4G3.cjs +0 -374
- package/dist/chunk-WXFZK4G3.cjs.map +0 -1
- package/dist/chunk-YLCN7EVV.js +0 -50
- package/dist/chunk-YLCN7EVV.js.map +0 -1
- package/dist/chunk-YOQXHFU3.cjs +0 -56
- package/dist/chunk-YOQXHFU3.cjs.map +0 -1
- package/dist/error.cjs.map +0 -1
- package/dist/error.js +0 -5
- package/dist/error.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js +0 -66
- package/dist/index.js.map +0 -1
- package/dist/monorepo.cjs.map +0 -1
- package/dist/monorepo.js +0 -5
- package/dist/monorepo.js.map +0 -1
- package/dist/package-json.cjs.map +0 -1
- package/dist/package-json.js +0 -3
- package/dist/package-json.js.map +0 -1
- package/dist/package-manager.cjs.map +0 -1
- package/dist/package-manager.js +0 -4
- package/dist/package-manager.js.map +0 -1
- package/dist/package.cjs.map +0 -1
- package/dist/package.js +0 -5
- package/dist/package.js.map +0 -1
- package/dist/tsconfig-G-HInwrt.d.ts +0 -30
- package/dist/tsconfig-d4zwQgCH.d.cts +0 -30
- package/dist/tsconfig.cjs +0 -36
- package/dist/tsconfig.cjs.map +0 -1
- package/dist/tsconfig.d.cts +0 -5
- package/dist/tsconfig.d.ts +0 -5
- package/dist/tsconfig.js +0 -3
- package/dist/tsconfig.js.map +0 -1
- package/dist/types-hoigZ9HA.d.cts +0 -9
- package/dist/types-hoigZ9HA.d.ts +0 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var t=(a,e)=>o(a,"name",{value:e,configurable:!0});const n=require("../package-manager.cjs");var c=Object.defineProperty,s=t((a,e)=>c(a,"name",{value:e,configurable:!0}),"t");class i extends Error{static{t(this,"u")}static{s(this,"PackageNotFoundError")}constructor(e,r){if(typeof e=="string"&&(e=[e]),e.length===0){super("Package was not found.");return}if(r===void 0)try{r=n.findPackageManagerSync().packageManager}catch{}r===void 0&&(r="npm"),super(`Package '${e.join(" ")}' was not found. Please install it using '${r} install ${e.join(" ")}'`)}get code(){return"PACKAGE_NOT_FOUND"}set code(e){throw new Error("Cannot overwrite code PACKAGE_NOT_FOUND")}get name(){return"PackageNotFoundError"}set name(e){throw new Error("Cannot overwrite name of PackageNotFoundError")}}const u=i;exports.u=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var B=Object.defineProperty;var w=(o,n)=>B(o,"name",{value:n,configurable:!0});import{readFileSync as I,findUpSync as O,findUp as $,writeJson as W,writeJsonSync as R}from"@visulima/fs";import{NotFoundError as T}from"@visulima/fs/error";import{join as f,resolve as D,isAbsolute as _,toNamespacedPath as q,dirname as A,relative as g,normalize as V}from"@visulima/path";import{parse as E}from"jsonc-parser";import{existsSync as u,statSync as j}from"node:fs";import G from"node:module";import{resolveExports as H}from"resolve-pkg-maps";import{toPath as N}from"@visulima/fs/utils";var K=Object.defineProperty,v=w((o,n)=>K(o,"name",{value:n,configurable:!0}),"d");const L=v(o=>E(I(o)),"readJsonc"),Q=v(()=>{const{findPnpApi:o}=G;return o?.(process.cwd())},"getPnpApi"),x=v((o,n,r,t)=>{const s=`resolveFromPackageJsonPath:${o}:${n}:${r}`;if(t?.has(s))return t.get(s);const e=L(o);if(!e)return;let i=n||"tsconfig.json";if(!r&&e.exports)try{const[a]=H(e.exports,n,["require","types"]);i=a}catch{return!1}else!n&&e.tsconfig&&(i=e.tsconfig);return i=f(o,"..",i),t?.set(s,i),i},"resolveFromPackageJsonPath"),b="package.json",S="tsconfig.json",X=v((o,n,r)=>{let t=o;if(o===".."&&(t=f(t,S)),o.startsWith(".")&&(t=D(n,t)),_(t)){if(u(t)){if(j(t).isFile())return t}else if(!t.endsWith(".json")){const c=`${t}.json`;if(u(c))return c}return}const[s,...e]=o.split("/"),i=s.startsWith("@")?`${s}/${e.shift()}`:s,a=e.join("/"),l=Q();if(l){const{resolveRequest:c}=l;try{if(i===o){const p=c(f(i,b),n);if(p){const y=x(p,a,!1,r);if(y&&u(y))return y}}else{let p;try{p=c(o,n,{extensions:[".json"]})}catch{p=c(f(o,S),n)}if(p)return p}}catch{}}const d=O(c=>{const p=f(c,"node_modules",i);if(u(p))return f("node_modules",i)},{cwd:n,type:"directory"});if(!d||!j(d).isDirectory())return;const h=f(d,b);if(u(h)){const c=x(h,a,!1,r);if(c===!1)return;if(c&&u(c)&&j(c).isFile())return c}const m=f(d,a),P=m.endsWith(".json");if(!P){const c=`${m}.json`;if(u(c))return c}if(u(m)){if(j(m).isDirectory()){const c=f(m,b);if(u(c)){const y=x(c,"",!0,r);if(y&&u(y))return y}const p=f(m,S);if(u(p))return p}else if(P)return m}},"resolveExtendsPath");var Y=Object.defineProperty,C=w((o,n)=>Y(o,"name",{value:n,configurable:!0}),"c");const Z=C(o=>E(I(o)),"readJsonc"),F=C(o=>q(/^\.{1,2}(?:\/.*)?$/.test(o)?o:`./${o}`),"normalizePath"),ee=C((o,n,r,t)=>{const s=X(o,n);if(!s)throw new T(`No such file or directory, for '${o}' found.`);if(r.has(s))throw new Error(`Circularity detected while resolving configuration: ${s}`);r.add(s);const e=A(s),i=U(s,t,r);delete i.references;const{compilerOptions:a}=i;if(a){const l=["baseUrl","outDir"];for(const d of l){const h=a[d];h&&(a[d]=g(n,f(e,h)).replaceAll("\\","/")||"./")}}return i.files&&(i.files=i.files.map(l=>g(n,f(e,l)))),i.include&&(i.include=i.include.map(l=>g(n,f(e,l)))),i.exclude&&(i.exclude=i.exclude.map(l=>g(n,f(e,l)))),i},"resolveExtends"),U=C((o,n,r=new Set)=>{let t;try{t=Z(o)||{}}catch{throw new Error(`Cannot resolve tsconfig at path: ${o}`)}if(typeof t!="object")throw new SyntaxError(`Failed to parse tsconfig at: ${o}`);const s=A(o);if(t.compilerOptions){const{compilerOptions:e}=t;e.paths&&!e.baseUrl&&(e[te]=s)}if(t.extends){const e=Array.isArray(t.extends)?t.extends:[t.extends];delete t.extends;for(const i of e.reverse()){const a=ee(i,s,new Set(r),n),l={...a,...t,compilerOptions:{...a.compilerOptions,...t.compilerOptions}};a.watchOptions&&(l.watchOptions={...a.watchOptions,...t.watchOptions}),t=l}}if(t.compilerOptions){const{compilerOptions:e}=t,i=["baseUrl","rootDir"];for(const l of i){const d=e[l];if(d){const h=D(s,d),m=g(s,h);e[l]=F(m)}}const{outDir:a}=e;a&&(Array.isArray(t.exclude)||(t.exclude=[]),t.exclude.includes(a)||t.exclude.push(a),e.outDir=F(a)),n?.tscCompatible&&e.module==="node16"&&(e.allowSyntheticDefaultImports=e.allowSyntheticDefaultImports??!0,e.esModuleInterop=e.esModuleInterop??!0,e.moduleDetection=e.moduleDetection??"force",e.moduleResolution=e.moduleResolution??"node16",e.target=e.target??"es2022",e.useDefineForClassFields=e.useDefineForClassFields??!0),n?.tscCompatible&&e.strict&&(e.noImplicitAny=e.noImplicitAny??!0,e.noImplicitThis=e.noImplicitThis??!0,e.strictNullChecks=e.strictNullChecks??!0,e.strictFunctionTypes=e.strictFunctionTypes??!0,e.strictBindCallApply=e.strictBindCallApply??!0,e.strictPropertyInitialization=e.strictPropertyInitialization??!0,e.alwaysStrict=e.alwaysStrict??!0,e.useUnknownInCatchVariables=e.useUnknownInCatchVariables??!0),n?.tscCompatible&&e.isolatedModules&&(e.preserveConstEnums=e.preserveConstEnums??!0),n?.tscCompatible&&e.esModuleInterop&&(e.allowSyntheticDefaultImports=e.allowSyntheticDefaultImports??!0),n?.tscCompatible&&e.target==="esnext"&&(e.useDefineForClassFields=e.useDefineForClassFields??!0)}else t.compilerOptions={};if(t.files&&(t.files=t.files.map(e=>F(e))),t.include&&(t.include=t.include.map(e=>V(e))),t.watchOptions){const{watchOptions:e}=t;e.excludeDirectories&&(e.excludeDirectories=e.excludeDirectories.map(i=>D(s,i)))}return t},"internalParseTsConfig"),te=Symbol("implicitBaseUrl"),k=C((o,n)=>U(o,n),"readTsConfig");var oe=Object.defineProperty,J=w((o,n)=>oe(o,"name",{value:n,configurable:!0}),"s");const M=new Map,ne=J(async(o,n={})=>{const r=n.configFileName??"tsconfig.json";let t=await $(r,{...o&&{cwd:o},type:"file"});if(t||(t=await $("jsconfig.json",{...o&&{cwd:o},type:"file"})),!t)throw new T(`No such file or directory, for ${r} or jsconfig.json found.`);const s=n.cache&&typeof n.cache!="boolean"?n.cache:M;if(n.cache&&s.has(t))return s.get(t);const e={config:k(t),path:t};return n.cache&&s.set(t,e),e},"findTsConfig"),ye=ne,se=J((o,n={})=>{const r=n.configFileName??"tsconfig.json";let t=O(r,{...o&&{cwd:o},type:"file"});if(t||(t=O("jsconfig.json",{...o&&{cwd:o},type:"file"})),!t)throw new T(`No such file or directory, for ${r} or jsconfig.json found.`);const s=n.cache&&typeof n.cache!="boolean"?n.cache:M;if(n.cache&&s.has(t))return s.get(t);const e={config:k(t),path:t};return n.cache&&s.set(t,e),e},"findTsConfigSync"),we=se;var ie=Object.defineProperty,z=w((o,n)=>ie(o,"name",{value:n,configurable:!0}),"n");const re=z(async(o,n={})=>{const{cwd:r,...t}=n,s=N(n.cwd??process.cwd());await W(f(s,"tsconfig.json"),o,t)},"writeTsConfig"),ge=re,Ce=z((o,n={})=>{const{cwd:r,...t}=n,s=N(n.cwd??process.cwd());R(f(s,"tsconfig.json"),o,t)},"writeTsConfigSync");export{ne as a,we as b,se as c,re as d,Ce as e,ye as f,te as i,k as r,ge as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=require("../shared/package.DipMHw9r.cjs");exports.findTSConfig=i.findTSConfig;exports.findTSConfigSync=i.findTSConfigSync;exports.findTsConfig=i.findTsConfig;exports.findTsConfigSync=i.findTsConfigSync;exports.implicitBaseUrlSymbol=i.implicitBaseUrlSymbol;exports.readTsConfig=i.readTsConfig;exports.writeTSConfig=i.writeTSConfig;exports.writeTsConfig=i.writeTsConfig;exports.writeTsConfigSync=i.writeTsConfigSync;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { T as TsConfigJsonResolved, a as TsConfigJson } from '../shared/package.SZmjOQBM.cjs';
|
|
2
|
+
import { WriteJsonOptions } from '@visulima/fs';
|
|
3
|
+
import 'normalize-package-data';
|
|
4
|
+
|
|
5
|
+
type Options$1 = {
|
|
6
|
+
cache?: Map<string, TsConfigJsonResolved> | boolean;
|
|
7
|
+
configFileName?: string;
|
|
8
|
+
};
|
|
9
|
+
type TsConfigResult = {
|
|
10
|
+
config: TsConfigJsonResolved;
|
|
11
|
+
path: string;
|
|
12
|
+
};
|
|
13
|
+
declare const findTsConfig: (cwd?: URL | string, options?: Options$1) => Promise<TsConfigResult>;
|
|
14
|
+
declare const findTSConfig: (cwd?: URL | string, options?: Options$1) => Promise<TsConfigResult>;
|
|
15
|
+
declare const findTsConfigSync: (cwd?: URL | string, options?: Options$1) => TsConfigResult;
|
|
16
|
+
declare const findTSConfigSync: (cwd?: URL | string, options?: Options$1) => TsConfigResult;
|
|
17
|
+
|
|
18
|
+
type Options = {
|
|
19
|
+
tscCompatible?: boolean;
|
|
20
|
+
};
|
|
21
|
+
declare const implicitBaseUrlSymbol: unique symbol;
|
|
22
|
+
declare const readTsConfig: (tsconfigPath: string, options?: Options) => TsConfigJsonResolved;
|
|
23
|
+
|
|
24
|
+
declare const writeTsConfig: (tsConfig: TsConfigJson, options?: WriteJsonOptions & {
|
|
25
|
+
cwd?: URL | string;
|
|
26
|
+
}) => Promise<void>;
|
|
27
|
+
declare const writeTSConfig: (tsConfig: TsConfigJson, options?: WriteJsonOptions & {
|
|
28
|
+
cwd?: URL | string;
|
|
29
|
+
}) => Promise<void>;
|
|
30
|
+
declare const writeTsConfigSync: (tsConfig: TsConfigJson, options?: WriteJsonOptions & {
|
|
31
|
+
cwd?: URL | string;
|
|
32
|
+
}) => void;
|
|
33
|
+
|
|
34
|
+
export { type TsConfigResult, findTSConfig, findTSConfigSync, findTsConfig, findTsConfigSync, implicitBaseUrlSymbol, readTsConfig, writeTSConfig, writeTsConfig, writeTsConfigSync };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { T as TsConfigJsonResolved, a as TsConfigJson } from '../shared/package.SZmjOQBM.mjs';
|
|
2
|
+
import { WriteJsonOptions } from '@visulima/fs';
|
|
3
|
+
import 'normalize-package-data';
|
|
4
|
+
|
|
5
|
+
type Options$1 = {
|
|
6
|
+
cache?: Map<string, TsConfigJsonResolved> | boolean;
|
|
7
|
+
configFileName?: string;
|
|
8
|
+
};
|
|
9
|
+
type TsConfigResult = {
|
|
10
|
+
config: TsConfigJsonResolved;
|
|
11
|
+
path: string;
|
|
12
|
+
};
|
|
13
|
+
declare const findTsConfig: (cwd?: URL | string, options?: Options$1) => Promise<TsConfigResult>;
|
|
14
|
+
declare const findTSConfig: (cwd?: URL | string, options?: Options$1) => Promise<TsConfigResult>;
|
|
15
|
+
declare const findTsConfigSync: (cwd?: URL | string, options?: Options$1) => TsConfigResult;
|
|
16
|
+
declare const findTSConfigSync: (cwd?: URL | string, options?: Options$1) => TsConfigResult;
|
|
17
|
+
|
|
18
|
+
type Options = {
|
|
19
|
+
tscCompatible?: boolean;
|
|
20
|
+
};
|
|
21
|
+
declare const implicitBaseUrlSymbol: unique symbol;
|
|
22
|
+
declare const readTsConfig: (tsconfigPath: string, options?: Options) => TsConfigJsonResolved;
|
|
23
|
+
|
|
24
|
+
declare const writeTsConfig: (tsConfig: TsConfigJson, options?: WriteJsonOptions & {
|
|
25
|
+
cwd?: URL | string;
|
|
26
|
+
}) => Promise<void>;
|
|
27
|
+
declare const writeTSConfig: (tsConfig: TsConfigJson, options?: WriteJsonOptions & {
|
|
28
|
+
cwd?: URL | string;
|
|
29
|
+
}) => Promise<void>;
|
|
30
|
+
declare const writeTsConfigSync: (tsConfig: TsConfigJson, options?: WriteJsonOptions & {
|
|
31
|
+
cwd?: URL | string;
|
|
32
|
+
}) => void;
|
|
33
|
+
|
|
34
|
+
export { type TsConfigResult, findTSConfig, findTSConfigSync, findTsConfig, findTsConfigSync, implicitBaseUrlSymbol, readTsConfig, writeTSConfig, writeTsConfig, writeTsConfigSync };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { T as TsConfigJsonResolved, a as TsConfigJson } from '../shared/package.SZmjOQBM.js';
|
|
2
|
+
import { WriteJsonOptions } from '@visulima/fs';
|
|
3
|
+
import 'normalize-package-data';
|
|
4
|
+
|
|
5
|
+
type Options$1 = {
|
|
6
|
+
cache?: Map<string, TsConfigJsonResolved> | boolean;
|
|
7
|
+
configFileName?: string;
|
|
8
|
+
};
|
|
9
|
+
type TsConfigResult = {
|
|
10
|
+
config: TsConfigJsonResolved;
|
|
11
|
+
path: string;
|
|
12
|
+
};
|
|
13
|
+
declare const findTsConfig: (cwd?: URL | string, options?: Options$1) => Promise<TsConfigResult>;
|
|
14
|
+
declare const findTSConfig: (cwd?: URL | string, options?: Options$1) => Promise<TsConfigResult>;
|
|
15
|
+
declare const findTsConfigSync: (cwd?: URL | string, options?: Options$1) => TsConfigResult;
|
|
16
|
+
declare const findTSConfigSync: (cwd?: URL | string, options?: Options$1) => TsConfigResult;
|
|
17
|
+
|
|
18
|
+
type Options = {
|
|
19
|
+
tscCompatible?: boolean;
|
|
20
|
+
};
|
|
21
|
+
declare const implicitBaseUrlSymbol: unique symbol;
|
|
22
|
+
declare const readTsConfig: (tsconfigPath: string, options?: Options) => TsConfigJsonResolved;
|
|
23
|
+
|
|
24
|
+
declare const writeTsConfig: (tsConfig: TsConfigJson, options?: WriteJsonOptions & {
|
|
25
|
+
cwd?: URL | string;
|
|
26
|
+
}) => Promise<void>;
|
|
27
|
+
declare const writeTSConfig: (tsConfig: TsConfigJson, options?: WriteJsonOptions & {
|
|
28
|
+
cwd?: URL | string;
|
|
29
|
+
}) => Promise<void>;
|
|
30
|
+
declare const writeTsConfigSync: (tsConfig: TsConfigJson, options?: WriteJsonOptions & {
|
|
31
|
+
cwd?: URL | string;
|
|
32
|
+
}) => void;
|
|
33
|
+
|
|
34
|
+
export { type TsConfigResult, findTSConfig, findTSConfigSync, findTsConfig, findTsConfigSync, implicitBaseUrlSymbol, readTsConfig, writeTSConfig, writeTsConfig, writeTsConfigSync };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as s,b as f,a,c as o,i as g,r,w as C,d as T,e}from"../shared/package.zhGeUcxO.mjs";export{s as findTSConfig,f as findTSConfigSync,a as findTsConfig,o as findTsConfigSync,g as implicitBaseUrlSymbol,r as readTsConfig,C as writeTSConfig,T as writeTsConfig,e as writeTsConfigSync};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/package",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.3",
|
|
4
4
|
"description": "One Package to rule them all, finds your root-dir, monorepo, package manager or tsconfig.json",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"default": "./dist/index.cjs"
|
|
62
62
|
},
|
|
63
63
|
"import": {
|
|
64
|
-
"types": "./dist/index.d.
|
|
65
|
-
"default": "./dist/index.
|
|
64
|
+
"types": "./dist/index.d.mts",
|
|
65
|
+
"default": "./dist/index.mjs"
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
"./monorepo": {
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"default": "./dist/monorepo.cjs"
|
|
72
72
|
},
|
|
73
73
|
"import": {
|
|
74
|
-
"types": "./dist/monorepo.d.
|
|
75
|
-
"default": "./dist/monorepo.
|
|
74
|
+
"types": "./dist/monorepo.d.mts",
|
|
75
|
+
"default": "./dist/monorepo.mjs"
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
"./package": {
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"default": "./dist/package.cjs"
|
|
82
82
|
},
|
|
83
83
|
"import": {
|
|
84
|
-
"types": "./dist/package.d.
|
|
85
|
-
"default": "./dist/package.
|
|
84
|
+
"types": "./dist/package.d.mts",
|
|
85
|
+
"default": "./dist/package.mjs"
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
88
|
"./package-json": {
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
"default": "./dist/package-json.cjs"
|
|
92
92
|
},
|
|
93
93
|
"import": {
|
|
94
|
-
"types": "./dist/package-json.d.
|
|
95
|
-
"default": "./dist/package-json.
|
|
94
|
+
"types": "./dist/package-json.d.mts",
|
|
95
|
+
"default": "./dist/package-json.mjs"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"./package-manager": {
|
|
@@ -101,18 +101,18 @@
|
|
|
101
101
|
"default": "./dist/package-manager.cjs"
|
|
102
102
|
},
|
|
103
103
|
"import": {
|
|
104
|
-
"types": "./dist/package-manager.d.
|
|
105
|
-
"default": "./dist/package-manager.
|
|
104
|
+
"types": "./dist/package-manager.d.mts",
|
|
105
|
+
"default": "./dist/package-manager.mjs"
|
|
106
106
|
}
|
|
107
107
|
},
|
|
108
108
|
"./tsconfig": {
|
|
109
109
|
"require": {
|
|
110
|
-
"types": "./dist/tsconfig.d.cts",
|
|
111
|
-
"default": "./dist/tsconfig.cjs"
|
|
110
|
+
"types": "./dist/tsconfig/index.d.cts",
|
|
111
|
+
"default": "./dist/tsconfig/index.cjs"
|
|
112
112
|
},
|
|
113
113
|
"import": {
|
|
114
|
-
"types": "./dist/tsconfig.d.
|
|
115
|
-
"default": "./dist/tsconfig.
|
|
114
|
+
"types": "./dist/tsconfig/index.d.mts",
|
|
115
|
+
"default": "./dist/tsconfig/index.mjs"
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
118
|
"./error": {
|
|
@@ -121,14 +121,14 @@
|
|
|
121
121
|
"default": "./dist/error.cjs"
|
|
122
122
|
},
|
|
123
123
|
"import": {
|
|
124
|
-
"types": "./dist/error.d.
|
|
125
|
-
"default": "./dist/error.
|
|
124
|
+
"types": "./dist/error.d.mts",
|
|
125
|
+
"default": "./dist/error.mjs"
|
|
126
126
|
}
|
|
127
127
|
},
|
|
128
128
|
"./package.json": "./package.json"
|
|
129
129
|
},
|
|
130
130
|
"main": "dist/index.cjs",
|
|
131
|
-
"module": "dist/index.
|
|
131
|
+
"module": "dist/index.mjs",
|
|
132
132
|
"types": "dist/index.d.ts",
|
|
133
133
|
"files": [
|
|
134
134
|
"dist/**",
|
|
@@ -137,19 +137,20 @@
|
|
|
137
137
|
"LICENSE.md"
|
|
138
138
|
],
|
|
139
139
|
"dependencies": {
|
|
140
|
-
"@visulima/fs": "2.1.
|
|
140
|
+
"@visulima/fs": "2.1.2",
|
|
141
|
+
"@visulima/path": "1.0.1",
|
|
141
142
|
"jsonc-parser": "^3.2.1",
|
|
142
143
|
"normalize-package-data": "^6.0.1",
|
|
143
|
-
"
|
|
144
|
-
"resolve-pkg-maps": "^1.0.0",
|
|
145
|
-
"type-fest": "^4.18.2"
|
|
144
|
+
"resolve-pkg-maps": "^1.0.0"
|
|
146
145
|
},
|
|
147
146
|
"devDependencies": {
|
|
147
|
+
"type-fest": "^4.18.2",
|
|
148
148
|
"@anolilab/eslint-config": "^15.0.3",
|
|
149
149
|
"@anolilab/prettier-config": "^5.0.14",
|
|
150
|
-
"@anolilab/semantic-release-
|
|
150
|
+
"@anolilab/semantic-release-pnpm": "^1.1.0",
|
|
151
|
+
"@anolilab/semantic-release-preset": "^8.1.0",
|
|
151
152
|
"@babel/core": "^7.24.5",
|
|
152
|
-
"@pnpm/exe": "^9.1.
|
|
153
|
+
"@pnpm/exe": "^9.1.2",
|
|
153
154
|
"@rushstack/eslint-plugin-security": "^0.8.1",
|
|
154
155
|
"@total-typescript/ts-reset": "^0.5.1",
|
|
155
156
|
"@types/node": "18.18.14",
|
|
@@ -166,14 +167,14 @@
|
|
|
166
167
|
"eslint-plugin-vitest": "^0.4.1",
|
|
167
168
|
"eslint-plugin-vitest-globals": "^1.5.0",
|
|
168
169
|
"execa": "^9.1.0",
|
|
169
|
-
"npm": "^10.
|
|
170
|
+
"npm": "^10.8.0",
|
|
170
171
|
"prettier": "^3.2.5",
|
|
171
172
|
"rimraf": "^5.0.7",
|
|
172
173
|
"semantic-release": "^23.1.1",
|
|
173
|
-
"sort-package-json": "^2.10.0",
|
|
174
174
|
"strip-ansi": "^7.1.0",
|
|
175
175
|
"tempy": "^3.1.0",
|
|
176
|
-
"
|
|
176
|
+
"@visulima/packem": "^1.0.0-alpha.20",
|
|
177
|
+
"esbuild": "^0.21.4",
|
|
177
178
|
"typescript": "^5.4.5",
|
|
178
179
|
"vitest": "^1.6.0",
|
|
179
180
|
"which-pm-runs": "file:",
|
|
@@ -203,23 +204,14 @@
|
|
|
203
204
|
"info_on_disabling_etc_no_deprecated": false
|
|
204
205
|
}
|
|
205
206
|
},
|
|
206
|
-
"sources": [
|
|
207
|
-
"src/error.ts",
|
|
208
|
-
"src/index.ts",
|
|
209
|
-
"src/monorepo.ts",
|
|
210
|
-
"src/package.ts",
|
|
211
|
-
"src/package-json.ts",
|
|
212
|
-
"src/package-manager.ts",
|
|
213
|
-
"src/tsconfig.ts"
|
|
214
|
-
],
|
|
215
207
|
"scripts": {
|
|
216
|
-
"build": "cross-env NODE_ENV=development
|
|
217
|
-
"build:prod": "cross-env NODE_ENV=production
|
|
208
|
+
"build": "cross-env NODE_ENV=development packem build",
|
|
209
|
+
"build:prod": "cross-env NODE_ENV=production packem build",
|
|
218
210
|
"clean": "rimraf node_modules dist .eslintcache",
|
|
219
|
-
"dev": "
|
|
211
|
+
"dev": "cross-env NODE_ENV=development packem build --watch",
|
|
220
212
|
"lint:eslint": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs",
|
|
221
213
|
"lint:eslint:fix": "pnpm run lint:eslint --fix",
|
|
222
|
-
"lint:
|
|
214
|
+
"lint:package-json": "publint --strict",
|
|
223
215
|
"lint:prettier": "prettier --config=.prettierrc.cjs --check .",
|
|
224
216
|
"lint:prettier:fix": "prettier --config=.prettierrc.cjs --write .",
|
|
225
217
|
"lint:types": "tsc --noEmit",
|
package/dist/chunk-5VO6NTKJ.js
DELETED
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
import { findUp, findUpSync, writeJson, readFileSync } from '@visulima/fs';
|
|
2
|
-
import { NotFoundError } from '@visulima/fs/error';
|
|
3
|
-
import { toPath } from '@visulima/fs/utils';
|
|
4
|
-
import { join, dirname, resolve, relative, normalize, toNamespacedPath } from 'pathe';
|
|
5
|
-
import { parse } from 'jsonc-parser';
|
|
6
|
-
import { existsSync, statSync } from 'node:fs';
|
|
7
|
-
import Module from 'node:module';
|
|
8
|
-
import { join as join$1, resolve as resolve$1, isAbsolute } from 'node:path';
|
|
9
|
-
import { resolveExports } from 'resolve-pkg-maps';
|
|
10
|
-
|
|
11
|
-
// src/tsconfig.ts
|
|
12
|
-
var readJsonc = (jsonPath) => parse(readFileSync(jsonPath));
|
|
13
|
-
var getPnpApi = () => {
|
|
14
|
-
const { findPnpApi } = Module;
|
|
15
|
-
return findPnpApi?.(process.cwd());
|
|
16
|
-
};
|
|
17
|
-
var resolveFromPackageJsonPath = (packageJsonPath, subpath, ignoreExports, cache) => {
|
|
18
|
-
const cacheKey = `resolveFromPackageJsonPath:${packageJsonPath}:${subpath}:${ignoreExports}`;
|
|
19
|
-
if (cache?.has(cacheKey)) {
|
|
20
|
-
return cache.get(cacheKey);
|
|
21
|
-
}
|
|
22
|
-
const packageJson = readJsonc(packageJsonPath);
|
|
23
|
-
if (!packageJson) {
|
|
24
|
-
return void 0;
|
|
25
|
-
}
|
|
26
|
-
let resolvedPath = subpath || "tsconfig.json";
|
|
27
|
-
if (!ignoreExports && packageJson.exports) {
|
|
28
|
-
try {
|
|
29
|
-
const [resolvedExport] = resolveExports(packageJson.exports, subpath, ["require", "types"]);
|
|
30
|
-
resolvedPath = resolvedExport;
|
|
31
|
-
} catch {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
} else if (!subpath && packageJson.tsconfig) {
|
|
35
|
-
resolvedPath = packageJson.tsconfig;
|
|
36
|
-
}
|
|
37
|
-
resolvedPath = join$1(packageJsonPath, "..", resolvedPath);
|
|
38
|
-
cache?.set(cacheKey, resolvedPath);
|
|
39
|
-
return resolvedPath;
|
|
40
|
-
};
|
|
41
|
-
var PACKAGE_JSON = "package.json";
|
|
42
|
-
var TS_CONFIG_JSON = "tsconfig.json";
|
|
43
|
-
var resolveExtendsPath = (requestedPath, directoryPath, cache) => {
|
|
44
|
-
let filePath = requestedPath;
|
|
45
|
-
if (requestedPath === "..") {
|
|
46
|
-
filePath = join$1(filePath, TS_CONFIG_JSON);
|
|
47
|
-
}
|
|
48
|
-
if (requestedPath.startsWith(".")) {
|
|
49
|
-
filePath = resolve$1(directoryPath, filePath);
|
|
50
|
-
}
|
|
51
|
-
if (isAbsolute(filePath)) {
|
|
52
|
-
if (existsSync(filePath)) {
|
|
53
|
-
if (statSync(filePath).isFile()) {
|
|
54
|
-
return filePath;
|
|
55
|
-
}
|
|
56
|
-
} else if (!filePath.endsWith(".json")) {
|
|
57
|
-
const jsonPath = `${filePath}.json`;
|
|
58
|
-
if (existsSync(jsonPath)) {
|
|
59
|
-
return jsonPath;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return void 0;
|
|
63
|
-
}
|
|
64
|
-
const [orgOrName, ...remaining] = requestedPath.split("/");
|
|
65
|
-
const packageName = orgOrName.startsWith("@") ? `${orgOrName}/${remaining.shift()}` : orgOrName;
|
|
66
|
-
const subpath = remaining.join("/");
|
|
67
|
-
const pnpApi = getPnpApi();
|
|
68
|
-
if (pnpApi) {
|
|
69
|
-
const { resolveRequest: resolveWithPnp } = pnpApi;
|
|
70
|
-
try {
|
|
71
|
-
if (packageName === requestedPath) {
|
|
72
|
-
const packageJsonPath2 = resolveWithPnp(join$1(packageName, PACKAGE_JSON), directoryPath);
|
|
73
|
-
if (packageJsonPath2) {
|
|
74
|
-
const resolvedPath = resolveFromPackageJsonPath(packageJsonPath2, subpath, false, cache);
|
|
75
|
-
if (resolvedPath && existsSync(resolvedPath)) {
|
|
76
|
-
return resolvedPath;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
} else {
|
|
80
|
-
let resolved;
|
|
81
|
-
try {
|
|
82
|
-
resolved = resolveWithPnp(requestedPath, directoryPath, { extensions: [".json"] });
|
|
83
|
-
} catch {
|
|
84
|
-
resolved = resolveWithPnp(join$1(requestedPath, TS_CONFIG_JSON), directoryPath);
|
|
85
|
-
}
|
|
86
|
-
if (resolved) {
|
|
87
|
-
return resolved;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
} catch {
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
const packagePath = findUpSync(
|
|
94
|
-
(directory) => {
|
|
95
|
-
const path = join$1(directory, "node_modules", packageName);
|
|
96
|
-
if (existsSync(path)) {
|
|
97
|
-
return join$1("node_modules", packageName);
|
|
98
|
-
}
|
|
99
|
-
return void 0;
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
cwd: directoryPath,
|
|
103
|
-
type: "directory"
|
|
104
|
-
}
|
|
105
|
-
);
|
|
106
|
-
if (!packagePath || !statSync(packagePath).isDirectory()) {
|
|
107
|
-
return void 0;
|
|
108
|
-
}
|
|
109
|
-
const packageJsonPath = join$1(packagePath, PACKAGE_JSON);
|
|
110
|
-
if (existsSync(packageJsonPath)) {
|
|
111
|
-
const resolvedPath = resolveFromPackageJsonPath(packageJsonPath, subpath, false, cache);
|
|
112
|
-
if (resolvedPath === false) {
|
|
113
|
-
return void 0;
|
|
114
|
-
}
|
|
115
|
-
if (resolvedPath && existsSync(resolvedPath) && statSync(resolvedPath).isFile()) {
|
|
116
|
-
return resolvedPath;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
const fullPackagePath = join$1(packagePath, subpath);
|
|
120
|
-
const jsonExtension = fullPackagePath.endsWith(".json");
|
|
121
|
-
if (!jsonExtension) {
|
|
122
|
-
const fullPackagePathWithJson = `${fullPackagePath}.json`;
|
|
123
|
-
if (existsSync(fullPackagePathWithJson)) {
|
|
124
|
-
return fullPackagePathWithJson;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
if (!existsSync(fullPackagePath)) {
|
|
128
|
-
return void 0;
|
|
129
|
-
}
|
|
130
|
-
if (statSync(fullPackagePath).isDirectory()) {
|
|
131
|
-
const fullPackageJsonPath = join$1(fullPackagePath, PACKAGE_JSON);
|
|
132
|
-
if (existsSync(fullPackageJsonPath)) {
|
|
133
|
-
const resolvedPath = resolveFromPackageJsonPath(fullPackageJsonPath, "", true, cache);
|
|
134
|
-
if (resolvedPath && existsSync(resolvedPath)) {
|
|
135
|
-
return resolvedPath;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
const tsconfigPath = join$1(fullPackagePath, TS_CONFIG_JSON);
|
|
139
|
-
if (existsSync(tsconfigPath)) {
|
|
140
|
-
return tsconfigPath;
|
|
141
|
-
}
|
|
142
|
-
} else if (jsonExtension) {
|
|
143
|
-
return fullPackagePath;
|
|
144
|
-
}
|
|
145
|
-
return void 0;
|
|
146
|
-
};
|
|
147
|
-
var resolve_extends_path_default = resolveExtendsPath;
|
|
148
|
-
|
|
149
|
-
// src/read-tsconfig.ts
|
|
150
|
-
var readJsonc2 = (jsonPath) => parse(readFileSync(jsonPath));
|
|
151
|
-
var normalizePath = (path) => toNamespacedPath(/^\.{1,2}(?:\/.*)?$/.test(path) ? path : `./${path}`);
|
|
152
|
-
var resolveExtends = (extendsPath, fromDirectoryPath, circularExtendsTracker, options) => {
|
|
153
|
-
const resolvedExtendsPath = resolve_extends_path_default(extendsPath, fromDirectoryPath);
|
|
154
|
-
if (!resolvedExtendsPath) {
|
|
155
|
-
throw new NotFoundError(`No such file or directory, for '${extendsPath}' found.`);
|
|
156
|
-
}
|
|
157
|
-
if (circularExtendsTracker.has(resolvedExtendsPath)) {
|
|
158
|
-
throw new Error(`Circularity detected while resolving configuration: ${resolvedExtendsPath}`);
|
|
159
|
-
}
|
|
160
|
-
circularExtendsTracker.add(resolvedExtendsPath);
|
|
161
|
-
const extendsDirectoryPath = dirname(resolvedExtendsPath);
|
|
162
|
-
const extendsConfig = internalParseTsConfig(resolvedExtendsPath, options, circularExtendsTracker);
|
|
163
|
-
delete extendsConfig.references;
|
|
164
|
-
const { compilerOptions } = extendsConfig;
|
|
165
|
-
if (compilerOptions) {
|
|
166
|
-
const resolvePaths = ["baseUrl", "outDir"];
|
|
167
|
-
for (const property of resolvePaths) {
|
|
168
|
-
const unresolvedPath = compilerOptions[property];
|
|
169
|
-
if (unresolvedPath) {
|
|
170
|
-
compilerOptions[property] = relative(fromDirectoryPath, join(extendsDirectoryPath, unresolvedPath)).replaceAll("\\", "/") || "./";
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
if (extendsConfig.files) {
|
|
175
|
-
extendsConfig.files = extendsConfig.files.map((file) => relative(fromDirectoryPath, join(extendsDirectoryPath, file)));
|
|
176
|
-
}
|
|
177
|
-
if (extendsConfig.include) {
|
|
178
|
-
extendsConfig.include = extendsConfig.include.map((file) => relative(fromDirectoryPath, join(extendsDirectoryPath, file)));
|
|
179
|
-
}
|
|
180
|
-
if (extendsConfig.exclude) {
|
|
181
|
-
extendsConfig.exclude = extendsConfig.exclude.map((file) => relative(fromDirectoryPath, join(extendsDirectoryPath, file)));
|
|
182
|
-
}
|
|
183
|
-
return extendsConfig;
|
|
184
|
-
};
|
|
185
|
-
var internalParseTsConfig = (tsconfigPath, options, circularExtendsTracker = /* @__PURE__ */ new Set()) => {
|
|
186
|
-
let config;
|
|
187
|
-
try {
|
|
188
|
-
config = readJsonc2(tsconfigPath) || {};
|
|
189
|
-
} catch {
|
|
190
|
-
throw new Error(`Cannot resolve tsconfig at path: ${tsconfigPath}`);
|
|
191
|
-
}
|
|
192
|
-
if (typeof config !== "object") {
|
|
193
|
-
throw new SyntaxError(`Failed to parse tsconfig at: ${tsconfigPath}`);
|
|
194
|
-
}
|
|
195
|
-
const directoryPath = dirname(tsconfigPath);
|
|
196
|
-
if (config.compilerOptions) {
|
|
197
|
-
const { compilerOptions } = config;
|
|
198
|
-
if (compilerOptions.paths && !compilerOptions.baseUrl) {
|
|
199
|
-
compilerOptions[implicitBaseUrlSymbol] = directoryPath;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
if (config.extends) {
|
|
203
|
-
const extendsPathList = Array.isArray(config.extends) ? config.extends : [config.extends];
|
|
204
|
-
delete config.extends;
|
|
205
|
-
for (const extendsPath of extendsPathList.reverse()) {
|
|
206
|
-
const extendsConfig = resolveExtends(extendsPath, directoryPath, new Set(circularExtendsTracker), options);
|
|
207
|
-
const merged = {
|
|
208
|
-
...extendsConfig,
|
|
209
|
-
...config,
|
|
210
|
-
compilerOptions: {
|
|
211
|
-
...extendsConfig.compilerOptions,
|
|
212
|
-
...config.compilerOptions
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
if (extendsConfig.watchOptions) {
|
|
216
|
-
merged.watchOptions = {
|
|
217
|
-
...extendsConfig.watchOptions,
|
|
218
|
-
...config.watchOptions
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
config = merged;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
if (config.compilerOptions) {
|
|
225
|
-
const { compilerOptions } = config;
|
|
226
|
-
const normalizedPaths = ["baseUrl", "rootDir"];
|
|
227
|
-
for (const property of normalizedPaths) {
|
|
228
|
-
const unresolvedPath = compilerOptions[property];
|
|
229
|
-
if (unresolvedPath) {
|
|
230
|
-
const resolvedBaseUrl = resolve(directoryPath, unresolvedPath);
|
|
231
|
-
const relativeBaseUrl = relative(directoryPath, resolvedBaseUrl);
|
|
232
|
-
compilerOptions[property] = normalizePath(relativeBaseUrl);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
const { outDir } = compilerOptions;
|
|
236
|
-
if (outDir) {
|
|
237
|
-
if (!Array.isArray(config.exclude)) {
|
|
238
|
-
config.exclude = [];
|
|
239
|
-
}
|
|
240
|
-
if (!config.exclude.includes(outDir)) {
|
|
241
|
-
config.exclude.push(outDir);
|
|
242
|
-
}
|
|
243
|
-
compilerOptions.outDir = normalizePath(outDir);
|
|
244
|
-
}
|
|
245
|
-
if (options?.tscCompatible && compilerOptions.module === "node16") {
|
|
246
|
-
compilerOptions.allowSyntheticDefaultImports = compilerOptions.allowSyntheticDefaultImports ?? true;
|
|
247
|
-
compilerOptions.esModuleInterop = compilerOptions.esModuleInterop ?? true;
|
|
248
|
-
compilerOptions.moduleDetection = compilerOptions.moduleDetection ?? "force";
|
|
249
|
-
compilerOptions.moduleResolution = compilerOptions.moduleResolution ?? "node16";
|
|
250
|
-
compilerOptions.target = compilerOptions.target ?? "es2022";
|
|
251
|
-
compilerOptions.useDefineForClassFields = compilerOptions.useDefineForClassFields ?? true;
|
|
252
|
-
}
|
|
253
|
-
if (options?.tscCompatible && compilerOptions.strict) {
|
|
254
|
-
compilerOptions.noImplicitAny = compilerOptions.noImplicitAny ?? true;
|
|
255
|
-
compilerOptions.noImplicitThis = compilerOptions.noImplicitThis ?? true;
|
|
256
|
-
compilerOptions.strictNullChecks = compilerOptions.strictNullChecks ?? true;
|
|
257
|
-
compilerOptions.strictFunctionTypes = compilerOptions.strictFunctionTypes ?? true;
|
|
258
|
-
compilerOptions.strictBindCallApply = compilerOptions.strictBindCallApply ?? true;
|
|
259
|
-
compilerOptions.strictPropertyInitialization = compilerOptions.strictPropertyInitialization ?? true;
|
|
260
|
-
compilerOptions.alwaysStrict = compilerOptions.alwaysStrict ?? true;
|
|
261
|
-
compilerOptions.useUnknownInCatchVariables = compilerOptions.useUnknownInCatchVariables ?? true;
|
|
262
|
-
}
|
|
263
|
-
if (options?.tscCompatible && compilerOptions.isolatedModules) {
|
|
264
|
-
compilerOptions.preserveConstEnums = compilerOptions.preserveConstEnums ?? true;
|
|
265
|
-
}
|
|
266
|
-
if (options?.tscCompatible && compilerOptions.esModuleInterop) {
|
|
267
|
-
compilerOptions.allowSyntheticDefaultImports = compilerOptions.allowSyntheticDefaultImports ?? true;
|
|
268
|
-
}
|
|
269
|
-
if (options?.tscCompatible && compilerOptions.target === "esnext") {
|
|
270
|
-
compilerOptions.useDefineForClassFields = compilerOptions.useDefineForClassFields ?? true;
|
|
271
|
-
}
|
|
272
|
-
} else {
|
|
273
|
-
config.compilerOptions = {};
|
|
274
|
-
}
|
|
275
|
-
if (config.files) {
|
|
276
|
-
config.files = config.files.map((element) => normalizePath(element));
|
|
277
|
-
}
|
|
278
|
-
if (config.include) {
|
|
279
|
-
config.include = config.include.map((element) => normalize(element));
|
|
280
|
-
}
|
|
281
|
-
if (config.watchOptions) {
|
|
282
|
-
const { watchOptions } = config;
|
|
283
|
-
if (watchOptions.excludeDirectories) {
|
|
284
|
-
watchOptions.excludeDirectories = watchOptions.excludeDirectories.map((excludePath) => resolve(directoryPath, excludePath));
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
return config;
|
|
288
|
-
};
|
|
289
|
-
var implicitBaseUrlSymbol = Symbol("implicitBaseUrl");
|
|
290
|
-
var readTsConfig = (tsconfigPath, options) => internalParseTsConfig(tsconfigPath, options);
|
|
291
|
-
|
|
292
|
-
// src/tsconfig.ts
|
|
293
|
-
var TsConfigFileCache = /* @__PURE__ */ new Map();
|
|
294
|
-
var findTsConfig = async (cwd, options = {}) => {
|
|
295
|
-
const configFileName = options.configFileName ?? "tsconfig.json";
|
|
296
|
-
let filePath = await findUp(configFileName, {
|
|
297
|
-
...cwd && { cwd },
|
|
298
|
-
type: "file"
|
|
299
|
-
});
|
|
300
|
-
if (!filePath) {
|
|
301
|
-
filePath = await findUp("jsconfig.json", {
|
|
302
|
-
...cwd && { cwd },
|
|
303
|
-
type: "file"
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
if (!filePath) {
|
|
307
|
-
throw new NotFoundError(`No such file or directory, for ${configFileName} or jsconfig.json found.`);
|
|
308
|
-
}
|
|
309
|
-
const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : TsConfigFileCache;
|
|
310
|
-
if (options.cache && cache.has(filePath)) {
|
|
311
|
-
return cache.get(filePath);
|
|
312
|
-
}
|
|
313
|
-
const output = {
|
|
314
|
-
config: readTsConfig(filePath),
|
|
315
|
-
path: filePath
|
|
316
|
-
};
|
|
317
|
-
if (options.cache) {
|
|
318
|
-
cache.set(filePath, output);
|
|
319
|
-
}
|
|
320
|
-
return output;
|
|
321
|
-
};
|
|
322
|
-
var findTSConfig = findTsConfig;
|
|
323
|
-
var findTsConfigSync = (cwd, options = {}) => {
|
|
324
|
-
const configFileName = options.configFileName ?? "tsconfig.json";
|
|
325
|
-
let filePath = findUpSync(configFileName, {
|
|
326
|
-
...cwd && { cwd },
|
|
327
|
-
type: "file"
|
|
328
|
-
});
|
|
329
|
-
if (!filePath) {
|
|
330
|
-
filePath = findUpSync("jsconfig.json", {
|
|
331
|
-
...cwd && { cwd },
|
|
332
|
-
type: "file"
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
if (!filePath) {
|
|
336
|
-
throw new NotFoundError(`No such file or directory, for ${configFileName} or jsconfig.json found.`);
|
|
337
|
-
}
|
|
338
|
-
const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : TsConfigFileCache;
|
|
339
|
-
if (options.cache && cache.has(filePath)) {
|
|
340
|
-
return cache.get(filePath);
|
|
341
|
-
}
|
|
342
|
-
const output = {
|
|
343
|
-
config: readTsConfig(filePath),
|
|
344
|
-
path: filePath
|
|
345
|
-
};
|
|
346
|
-
if (options.cache) {
|
|
347
|
-
cache.set(filePath, output);
|
|
348
|
-
}
|
|
349
|
-
return output;
|
|
350
|
-
};
|
|
351
|
-
var findTSConfigSync = findTsConfigSync;
|
|
352
|
-
var writeTsConfig = async (data, options = {}) => {
|
|
353
|
-
const { cwd, ...writeOptions } = options;
|
|
354
|
-
const directory = toPath(options.cwd ?? process.cwd());
|
|
355
|
-
await writeJson(join(directory, "tsconfig.json"), data, writeOptions);
|
|
356
|
-
};
|
|
357
|
-
var writeTSConfig = writeTsConfig;
|
|
358
|
-
|
|
359
|
-
export { findTSConfig, findTSConfigSync, findTsConfig, findTsConfigSync, implicitBaseUrlSymbol, readTsConfig, writeTSConfig, writeTsConfig };
|
|
360
|
-
//# sourceMappingURL=out.js.map
|
|
361
|
-
//# sourceMappingURL=chunk-5VO6NTKJ.js.map
|