ts-ag 1.1.13 → 1.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +14 -14
- package/dist/index.d.mts.map +1 -1
- package/dist/scripts/ts-alias.d.mts +31 -1
- package/dist/scripts/ts-alias.d.mts.map +1 -0
- package/dist/scripts/ts-alias.mjs +226 -88
- package/dist/scripts/ts-alias.mjs.map +1 -1
- package/dist/scripts/ts-build-config.d.mts +49 -1
- package/dist/scripts/ts-build-config.d.mts.map +1 -0
- package/dist/scripts/ts-build-config.mjs +7 -2
- package/dist/scripts/ts-build-config.mjs.map +1 -1
- package/package.json +9 -10
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import { GenericSchema, GenericSchemaAsync, SafeParseResult } from "valibot";
|
|
3
|
-
import * as cookie from "cookie";
|
|
3
|
+
import * as _$cookie from "cookie";
|
|
4
4
|
import { Result, ResultAsync } from "neverthrow";
|
|
5
|
-
import * as _aws_sdk_client_cognito_identity_provider0 from "@aws-sdk/client-cognito-identity-provider";
|
|
5
|
+
import * as _$_aws_sdk_client_cognito_identity_provider0 from "@aws-sdk/client-cognito-identity-provider";
|
|
6
6
|
import { AdminGetUserCommandOutput, AttributeType, CognitoIdentityProviderClient } from "@aws-sdk/client-cognito-identity-provider";
|
|
7
7
|
import { S3Client } from "@aws-sdk/client-s3";
|
|
8
8
|
import { Plugin } from "unified";
|
|
@@ -291,7 +291,7 @@ declare function response_ok<Body extends {
|
|
|
291
291
|
/**
|
|
292
292
|
* Wraps cookies parse along with the api gateway event with neverthrow
|
|
293
293
|
*/
|
|
294
|
-
declare const getCookies: (event: APIGatewayProxyEventV2WithLambdaAuthorizer<any> | APIGatewayRequestAuthorizerEventV2) => Result<cookie.Cookies, {
|
|
294
|
+
declare const getCookies: (event: APIGatewayProxyEventV2WithLambdaAuthorizer<any> | APIGatewayRequestAuthorizerEventV2) => Result<_$cookie.Cookies, {
|
|
295
295
|
type: 'lambda_unauthorized';
|
|
296
296
|
message: string;
|
|
297
297
|
}>;
|
|
@@ -434,7 +434,7 @@ declare function extractAttributes(attrs: AttributeType[] | undefined): Record<s
|
|
|
434
434
|
declare const getUserGroups: (a: {
|
|
435
435
|
username: string;
|
|
436
436
|
userPoolId: string;
|
|
437
|
-
}) => ResultAsync<_aws_sdk_client_cognito_identity_provider0.AdminListGroupsForUserCommandOutput, type_error_cognito>;
|
|
437
|
+
}) => ResultAsync<_$_aws_sdk_client_cognito_identity_provider0.AdminListGroupsForUserCommandOutput, type_error_cognito>;
|
|
438
438
|
//#endregion
|
|
439
439
|
//#region src/cognito/password.d.ts
|
|
440
440
|
/**
|
|
@@ -452,7 +452,7 @@ declare function computeSecretHash(username: string, clientId: string, clientSec
|
|
|
452
452
|
* @param oldPassword - Current password.
|
|
453
453
|
* @param newPassword - New password to set.
|
|
454
454
|
*/
|
|
455
|
-
declare const changePassword: (accessToken: string, oldPassword: string, newPassword: string) => ResultAsync<_aws_sdk_client_cognito_identity_provider0.ChangePasswordCommandOutput, type_error_cognito>;
|
|
455
|
+
declare const changePassword: (accessToken: string, oldPassword: string, newPassword: string) => ResultAsync<_$_aws_sdk_client_cognito_identity_provider0.ChangePasswordCommandOutput, type_error_cognito>;
|
|
456
456
|
/**
|
|
457
457
|
* Completes a forgot-password flow by submitting the confirmation code and new password.
|
|
458
458
|
*
|
|
@@ -468,7 +468,7 @@ declare const confirmForgotPassword: (a: {
|
|
|
468
468
|
newPassword: string;
|
|
469
469
|
clientId: string;
|
|
470
470
|
clientSecret: string;
|
|
471
|
-
}) => ResultAsync<_aws_sdk_client_cognito_identity_provider0.ConfirmForgotPasswordCommandOutput, type_error_cognito>;
|
|
471
|
+
}) => ResultAsync<_$_aws_sdk_client_cognito_identity_provider0.ConfirmForgotPasswordCommandOutput, type_error_cognito>;
|
|
472
472
|
/**
|
|
473
473
|
* Confirms a user's signup using the confirmation code sent by Cognito.
|
|
474
474
|
*
|
|
@@ -482,7 +482,7 @@ declare const confirmSignup: (a: {
|
|
|
482
482
|
confirmationCode: string;
|
|
483
483
|
clientId: string;
|
|
484
484
|
clientSecret: string;
|
|
485
|
-
}) => ResultAsync<_aws_sdk_client_cognito_identity_provider0.ConfirmSignUpCommandOutput, type_error_cognito>;
|
|
485
|
+
}) => ResultAsync<_$_aws_sdk_client_cognito_identity_provider0.ConfirmSignUpCommandOutput, type_error_cognito>;
|
|
486
486
|
/**
|
|
487
487
|
* Starts a forgot-password flow by sending a reset code to the user.
|
|
488
488
|
*
|
|
@@ -494,7 +494,7 @@ declare const forgotPassword: (a: {
|
|
|
494
494
|
username: string;
|
|
495
495
|
clientId: string;
|
|
496
496
|
clientSecret: string;
|
|
497
|
-
}) => ResultAsync<_aws_sdk_client_cognito_identity_provider0.ForgotPasswordCommandOutput, type_error_cognito>;
|
|
497
|
+
}) => ResultAsync<_$_aws_sdk_client_cognito_identity_provider0.ForgotPasswordCommandOutput, type_error_cognito>;
|
|
498
498
|
/**
|
|
499
499
|
* Signs a user in with ADMIN_USER_PASSWORD_AUTH.
|
|
500
500
|
*
|
|
@@ -510,7 +510,7 @@ declare const login: (a: {
|
|
|
510
510
|
clientId: string;
|
|
511
511
|
clientSecret: string;
|
|
512
512
|
userPoolId: string;
|
|
513
|
-
}) => ResultAsync<_aws_sdk_client_cognito_identity_provider0.AdminInitiateAuthCommandOutput, type_error_cognito>;
|
|
513
|
+
}) => ResultAsync<_$_aws_sdk_client_cognito_identity_provider0.AdminInitiateAuthCommandOutput, type_error_cognito>;
|
|
514
514
|
/**
|
|
515
515
|
* Exchanges a refresh token for new tokens.
|
|
516
516
|
*
|
|
@@ -526,13 +526,13 @@ declare const refreshTokens: (a: {
|
|
|
526
526
|
clientId: string;
|
|
527
527
|
clientSecret: string;
|
|
528
528
|
userPoolId: string;
|
|
529
|
-
}) => ResultAsync<_aws_sdk_client_cognito_identity_provider0.AdminInitiateAuthCommandOutput, type_error_cognito>;
|
|
529
|
+
}) => ResultAsync<_$_aws_sdk_client_cognito_identity_provider0.AdminInitiateAuthCommandOutput, type_error_cognito>;
|
|
530
530
|
/**
|
|
531
531
|
* Globally signs out a user by invalidating all refresh tokens.
|
|
532
532
|
*
|
|
533
533
|
* @param accessToken - Access token for the authenticated user.
|
|
534
534
|
*/
|
|
535
|
-
declare const logout: (accessToken: string) => ResultAsync<_aws_sdk_client_cognito_identity_provider0.GlobalSignOutCommandOutput, type_error_cognito>;
|
|
535
|
+
declare const logout: (accessToken: string) => ResultAsync<_$_aws_sdk_client_cognito_identity_provider0.GlobalSignOutCommandOutput, type_error_cognito>;
|
|
536
536
|
/**
|
|
537
537
|
* Completes a NEW_PASSWORD_REQUIRED challenge for users who must set a new password.
|
|
538
538
|
*
|
|
@@ -548,7 +548,7 @@ declare const resetPassword: (a: {
|
|
|
548
548
|
username: string;
|
|
549
549
|
clientId: string;
|
|
550
550
|
clientSecret: string;
|
|
551
|
-
}) => ResultAsync<_aws_sdk_client_cognito_identity_provider0.RespondToAuthChallengeCommandOutput, type_error_cognito>;
|
|
551
|
+
}) => ResultAsync<_$_aws_sdk_client_cognito_identity_provider0.RespondToAuthChallengeCommandOutput, type_error_cognito>;
|
|
552
552
|
/**
|
|
553
553
|
* Registers a new user with Cognito and optional custom attributes.
|
|
554
554
|
*
|
|
@@ -563,7 +563,7 @@ declare const signUp: (a: {
|
|
|
563
563
|
password: string;
|
|
564
564
|
clientId: string;
|
|
565
565
|
clientSecret: string;
|
|
566
|
-
} & Record<string, unknown>) => ResultAsync<_aws_sdk_client_cognito_identity_provider0.SignUpCommandOutput, type_error_cognito>;
|
|
566
|
+
} & Record<string, unknown>) => ResultAsync<_$_aws_sdk_client_cognito_identity_provider0.SignUpCommandOutput, type_error_cognito>;
|
|
567
567
|
/**
|
|
568
568
|
* Exchanges an OAuth2 authorization code for Cognito tokens using the token endpoint.
|
|
569
569
|
* See https://docs.aws.amazon.com/cognito/latest/developerguide/token-endpoint.html for request/response fields and grant details.
|
|
@@ -759,7 +759,7 @@ interface RequestPresigningArguments extends RequestSigningArguments {
|
|
|
759
759
|
}
|
|
760
760
|
//#endregion
|
|
761
761
|
//#region src/s3/signedUrl.d.ts
|
|
762
|
-
declare const getSignedUrl: <InputTypesUnion extends object, InputType extends InputTypesUnion, OutputType extends MetadataBearer = MetadataBearer>(client: _aws_sdk_client_cognito_identity_provider0.__Client<any, InputTypesUnion, MetadataBearer, any>, command: _aws_sdk_client_cognito_identity_provider0.$Command<InputType, OutputType, any, InputTypesUnion, MetadataBearer>, options?: RequestPresigningArguments | undefined) => ResultAsync<string, unknown>;
|
|
762
|
+
declare const getSignedUrl: <InputTypesUnion extends object, InputType extends InputTypesUnion, OutputType extends MetadataBearer = MetadataBearer>(client: _$_aws_sdk_client_cognito_identity_provider0.__Client<any, InputTypesUnion, MetadataBearer, any>, command: _$_aws_sdk_client_cognito_identity_provider0.$Command<InputType, OutputType, any, InputTypesUnion, MetadataBearer>, options?: RequestPresigningArguments | undefined) => ResultAsync<string, unknown>;
|
|
763
763
|
//#endregion
|
|
764
764
|
//#region src/s3/object.d.ts
|
|
765
765
|
/**
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":["ResponseMetadata","httpStatusCode","requestId","extendedRequestId","cfId","attempts","totalRetryDelay","MetadataBearer","$metadata","Agent","hAgent","AgentOptions","hAgentOptions","hsAgent","hsAgentOptions","HttpRequest","IHttpRequest","Logger","RequestHandlerParams","NodeHttpHandlerOptions","FetchHttpHandlerOptions","connectionTimeout","requestTimeout","throwOnRequestTimeout","socketTimeout","socketAcquisitionWarningTimeout","httpAgent","httpsAgent","logger","RequestInit","keepAlive","credentials","cache","requestInit","httpRequest","_0","global","sideEffect","Message","HttpRequest","DateInput","Date","SigningArguments","signingDate","signingService","signingRegion","RequestSigningArguments","Set","unsignableHeaders","signableHeaders","RequestPresigningArguments","expiresIn","unhoistableHeaders","hoistableHeaders","EventSigningArguments","priorSignature","RequestPresigner","Promise","presign","requestToSign","options","RequestSigner","sign","StringSigner","stringToSign","FormattedEvent","Uint8Array","headers","payload","EventSigner","event","SignableMessage","message","SignedMessage","signature","MessageSigner","signMessage","args","Data","Point","line","column","offset","Position","start","end","Literal","Node","value","type","data","position","Parent","children","Data","UnistData","Literal","UnistLiteral","Node","UnistNode","Parent","UnistParent","Properties","Array","PropertyName","ElementContent","ElementContentMap","Comment","Element","Text","comment","element","text","RootContent","RootContentMap","Doctype","doctype","Content","Literals","Nodes","Extract","Root","Parents","data","value","children","CommentData","type","DoctypeData","ElementData","tagName","properties","content","RootData","TextData"],"sources":["../src/lambda/handlerUtils.ts","../src/lambda/client-types.ts","../src/lambda/client.ts","../src/lambda/errors.ts","../src/lambda/response.ts","../src/lambda/server/authentication.ts","../src/cognito/client.ts","../src/cognito/errors.ts","../src/cognito/user.ts","../src/cognito/password.ts","../src/s3/client.ts","../src/s3/errors.ts","../node_modules/.pnpm/@smithy+types@4.13.1/node_modules/@smithy/types/dist-types/response.d.ts","../node_modules/.pnpm/@smithy+types@4.13.1/node_modules/@smithy/types/dist-types/http/httpHandlerInitialization.d.ts","../node_modules/.pnpm/@smithy+types@4.13.1/node_modules/@smithy/types/dist-types/signature.d.ts","../src/s3/signedUrl.ts","../src/s3/object.ts","../src/dynamo/errors.ts","../src/ses/errors.ts","../node_modules/.pnpm/@types+unist@3.0.3/node_modules/@types/unist/index.d.ts","../node_modules/.pnpm/@types+hast@3.0.4/node_modules/@types/hast/index.d.ts","../src/rehype/flat-toc.ts","../src/utils/valibot.ts","../src/types/deep.ts","../src/utils/object.ts","../src/utils/fs.ts","../src/utils/cli.ts","../src/types/safe.ts"],"x_google_ignoreList":[12,13,14,19,20],"mappings":";;;;;;;;;;;;;KAGY,WAAA;AAAA,KACA,SAAA;AAAA,KAEA,SAAA;EAAc,OAAA;EAAiB,KAAA;IAAU,IAAA;IAAc,KAAA;EAAA;AAAA;;;;KAKvD,qBA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adata","httpStatusCode","requestId","extendedRequestId","cfId","attempts","totalRetryDelay","MetadataBearer","$metadata","Agent","hAgent","AgentOptions","hAgentOptions","hsAgent","hsAgentOptions","HttpRequest","IHttpRequest","Logger","RequestHandlerParams","NodeHttpHandlerOptions","FetchHttpHandlerOptions","connectionTimeout","requestTimeout","throwOnRequestTimeout","socketTimeout","socketAcquisitionWarningTimeout","httpAgent","httpsAgent","logger","RequestInit","keepAlive","credentials","cache","requestInit","httpRequest","_0","global","sideEffect","Message","HttpRequest","DateInput","Date","SigningArguments","signingDate","signingService","signingRegion","RequestSigningArguments","Set","unsignableHeaders","signableHeaders","RequestPresigningArguments","expiresIn","unhoistableHeaders","hoistableHeaders","EventSigningArguments","priorSignature","RequestPresigner","Promise","presign","requestToSign","options","RequestSigner","sign","StringSigner","stringToSign","FormattedEvent","Uint8Array","headers","payload","EventSigner","event","SignableMessage","message","SignedMessage","signature","MessageSigner","signMessage","args","Data","Point","line","column","offset","Position","start","end","Literal","Node","value","type","data","position","Parent","children","Data","UnistData","Literal","UnistLiteral","Node","UnistNode","Parent","UnistParent","Properties","Array","PropertyName","ElementContent","ElementContentMap","Comment","Element","Text","comment","element","text","RootContent","RootContentMap","Doctype","doctype","Content","Literals","Nodes","Extract","Root","Parents","data","value","children","CommentData","type","DoctypeData","ElementData","tagName","properties","content","RootData","TextData"],"sources":["../src/lambda/handlerUtils.ts","../src/lambda/client-types.ts","../src/lambda/client.ts","../src/lambda/errors.ts","../src/lambda/response.ts","../src/lambda/server/authentication.ts","../src/cognito/client.ts","../src/cognito/errors.ts","../src/cognito/user.ts","../src/cognito/password.ts","../src/s3/client.ts","../src/s3/errors.ts","../node_modules/.pnpm/@smithy+types@4.13.1/node_modules/@smithy/types/dist-types/response.d.ts","../node_modules/.pnpm/@smithy+types@4.13.1/node_modules/@smithy/types/dist-types/http/httpHandlerInitialization.d.ts","../node_modules/.pnpm/@smithy+types@4.13.1/node_modules/@smithy/types/dist-types/signature.d.ts","../src/s3/signedUrl.ts","../src/s3/object.ts","../src/dynamo/errors.ts","../src/ses/errors.ts","../node_modules/.pnpm/@types+unist@3.0.3/node_modules/@types/unist/index.d.ts","../node_modules/.pnpm/@types+hast@3.0.4/node_modules/@types/hast/index.d.ts","../src/rehype/flat-toc.ts","../src/utils/valibot.ts","../src/types/deep.ts","../src/utils/object.ts","../src/utils/fs.ts","../src/utils/cli.ts","../src/types/safe.ts"],"x_google_ignoreList":[12,13,14,19,20],"mappings":";;;;;;;;;;;;;KAGY,WAAA;AAAA,KACA,SAAA;AAAA,KAEA,SAAA;EAAc,OAAA;EAAiB,KAAA;IAAU,IAAA;IAAc,KAAA;EAAA;AAAA;;;;KAKvD,qBAAA;EACV,UAAA,EAAY,SAAA;EACZ,OAAA;IAAA,CAAa,MAAA;EAAA;EACb,IAAA,GAAO,SAAA;EACP,eAAA;EACA,OAAA;AAAA;AAAA,KAGU,kBAAA;EACV,UAAA,EAAY,WAAA;EACZ,OAAA;IAAA,CAAa,MAAA;EAAA;EACb,IAAA;EACA,eAAA;EACA,OAAA;AAAA;;;AAbF;KAkBY,gBAAA,GAAmB,qBAAA,GAAwB,kBAAA;AAAA,KAG3C,iBAAA,OAAwB,KAAA,EAAO,CAAA,EAAG,OAAA,EAAS,OAAA,KAAY,OAAA,CAAQ,uBAAA;AAAA,KAG/D,oBAAA,WAA+B,0CAAA,UACzC,KAAA,EAAO,CAAA,EACP,OAAA,EAAS,OAAA,KACN,OAAA,CAAQ,gBAAA;;;;;;;;;;;AAnBb;;;;iBAmCgB,WAAA,WAAsB,0CAAA,MAAA,CACpC,OAAA,EAAS,oBAAA,CAAqB,CAAA,IAC7B,iBAAA,CAAkB,CAAA;;;;;;;;;KC7CT,QAAA,WAAmB,YAAA,YAAwB,CAAA,oBAAqB,CAAA,cAAe,OAAA,CACzF,CAAA;EACE,IAAA,EAAM,CAAA;EAAG,MAAA,EAAQ,CAAA;AAAA;;;ADVrB;;;;KCmBY,SAAA,WAAoB,YAAA,YAAwB,CAAA,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wBoGgB,YAAA,OAAA,CAAoB,MAAA,EAAQ,CAAA,EAAG,KAAA,EAAO,EAAA,GAAK,EAAA;;;;;;iBC9GrC,MAAA,CAAO,QAAA,WAAmB,OAAA;;;;;iBAa1B,gBAAA,CAAiB,QAAA,UAAkB,OAAA,WAAkB,OAAA;;;;iBA4BrD,eAAA,CAAgB,QAAA,WAAmB,OAAA,CAAQ,WAAA;;;cChDpD,SAAA,GAAS,MAAA,EAAY,UAAA,QAAkB,SAAA,MAAa,IAAA;;;KCFrD,QAAA,2BAAmC,CAAA,eAAgB,IAAA,CAAK,CAAA,EAAG,CAAA"}
|
|
@@ -1 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
import { FSWatcher } from "chokidar";
|
|
2
|
+
|
|
3
|
+
//#region src/scripts/ts-alias.d.ts
|
|
4
|
+
type AliasTarget = {
|
|
5
|
+
configPath: string;
|
|
6
|
+
outDir: string;
|
|
7
|
+
};
|
|
8
|
+
declare function unique(items: string[]): string[];
|
|
9
|
+
/**
|
|
10
|
+
* If the path refers to a file then it returns it otherwise joins tsconfig.json
|
|
11
|
+
*/
|
|
12
|
+
declare function resolveTsConfigPath(refAbsPath: string): string;
|
|
13
|
+
declare function resolveOutDir(tsconfigPath: string, outDir: string): string;
|
|
14
|
+
declare function isAliasOutputFile(filePath: string): boolean;
|
|
15
|
+
declare function isWithinDir(filePath: string, dirPath: string): boolean;
|
|
16
|
+
declare function discoverAliasTargets(entry: string, verbose: boolean): Promise<{
|
|
17
|
+
targets: AliasTarget[];
|
|
18
|
+
visitedConfigs: string[];
|
|
19
|
+
}>;
|
|
20
|
+
declare function processAliasTarget(target: AliasTarget): Promise<void>;
|
|
21
|
+
declare function syncWatcherPaths(watcher: FSWatcher, currentPaths: Set<string>, nextPaths: Set<string>): Promise<Set<string>>;
|
|
22
|
+
declare function createRegenerator(entry: string, verbose: boolean): {
|
|
23
|
+
run: (reason?: string) => Promise<void>;
|
|
24
|
+
syncConfigWatcher: (watcher: FSWatcher) => Promise<void>;
|
|
25
|
+
syncOutputWatcher: (watcher: FSWatcher) => Promise<void>;
|
|
26
|
+
getTargets: () => AliasTarget[];
|
|
27
|
+
};
|
|
28
|
+
declare function main(): Promise<void>;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { AliasTarget, createRegenerator, discoverAliasTargets, isAliasOutputFile, isWithinDir, main, processAliasTarget, resolveOutDir, resolveTsConfigPath, syncWatcherPaths, unique };
|
|
31
|
+
//# sourceMappingURL=ts-alias.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-alias.d.mts","names":[],"sources":["../../src/scripts/ts-alias.ts"],"mappings":";;;KAwBY,WAAA;EAAgB,UAAA;EAAoB,MAAA;AAAA;AAAA,iBAEhC,MAAA,CAAO,KAAA;;AAAvB;;iBAOgB,mBAAA,CAAoB,UAAA;AAAA,iBAKpB,aAAA,CAAc,YAAA,UAAsB,MAAA;AAAA,iBAKpC,iBAAA,CAAkB,QAAA;AAAA,iBAIlB,WAAA,CAAY,QAAA,UAAkB,OAAA;AAAA,iBAKxB,oBAAA,CACpB,KAAA,UACA,OAAA,YACC,OAAA;EAAU,OAAA,EAAS,WAAA;EAAe,cAAA;AAAA;AAAA,iBAiDf,kBAAA,CAAmB,MAAA,EAAQ,WAAA,GAAc,OAAA;AAAA,iBAezC,gBAAA,CACpB,OAAA,EAAS,SAAA,EACT,YAAA,EAAc,GAAA,UACd,SAAA,EAAW,GAAA,WACV,OAAA,CAAQ,GAAA;AAAA,iBAUK,iBAAA,CACd,KAAA,UACA,OAAA;EAEA,GAAA,GAAM,MAAA,cAAoB,OAAA;EAC1B,iBAAA,GAAoB,OAAA,EAAS,SAAA,KAAc,OAAA;EAC3C,iBAAA,GAAoB,OAAA,EAAS,SAAA,KAAc,OAAA;EAC3C,UAAA,QAAkB,WAAA;AAAA;AAAA,iBAqDE,IAAA,CAAA,GAAQ,OAAA"}
|
|
@@ -1,63 +1,193 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import { t as colorText } from "../cli-DIua8C8m.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { dirname, isAbsolute, relative, resolve } from "path";
|
|
4
|
+
import { parseArgs } from "util";
|
|
4
5
|
import console from "console";
|
|
5
6
|
import { existsSync } from "fs";
|
|
7
|
+
import { fileURLToPath } from "url";
|
|
6
8
|
import { watch } from "chokidar";
|
|
7
|
-
import {
|
|
9
|
+
import { parseTsconfig } from "get-tsconfig";
|
|
8
10
|
import { replaceTscAliasPaths } from "tsc-alias";
|
|
9
11
|
//#region src/scripts/ts-alias.ts
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
+
const RELEVANT_OUTPUT_EXTENSIONS = [
|
|
13
|
+
".js",
|
|
14
|
+
".jsx",
|
|
15
|
+
".mjs",
|
|
16
|
+
".cjs",
|
|
17
|
+
".d.ts",
|
|
18
|
+
".d.mts",
|
|
19
|
+
".d.cts"
|
|
20
|
+
];
|
|
12
21
|
const LABEL = colorText("cyan", "[ts-alias]");
|
|
13
22
|
const formatPath = (filePath) => colorText("dim", relative(process.cwd(), filePath));
|
|
14
23
|
const logInfo = (message) => console.log(`${LABEL} ${message}`);
|
|
15
24
|
const logWarn = (message) => console.warn(`${LABEL} ${colorText("yellow", message)}`);
|
|
16
25
|
const logError = (message) => console.error(`${LABEL} ${colorText("red", message)}`);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*/
|
|
20
|
-
async function findDistFolders(baseDir) {
|
|
21
|
-
return await glob("**/dist", {
|
|
22
|
-
cwd: baseDir,
|
|
23
|
-
ignore: [
|
|
24
|
-
"**/node_modules/**",
|
|
25
|
-
"**/\\.git/**",
|
|
26
|
-
"**/\\.vscode/**",
|
|
27
|
-
"**/\\.idea/**",
|
|
28
|
-
"**/coverage/**",
|
|
29
|
-
"**/build/**",
|
|
30
|
-
"**/cdk.out/**"
|
|
31
|
-
],
|
|
32
|
-
absolute: true
|
|
33
|
-
});
|
|
26
|
+
function unique(items) {
|
|
27
|
+
return Array.from(new Set(items));
|
|
34
28
|
}
|
|
35
29
|
/**
|
|
36
|
-
*
|
|
30
|
+
* If the path refers to a file then it returns it otherwise joins tsconfig.json
|
|
37
31
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
function resolveTsConfigPath(refAbsPath) {
|
|
33
|
+
if (refAbsPath.endsWith(".json")) return refAbsPath;
|
|
34
|
+
return resolve(refAbsPath, "tsconfig.json");
|
|
35
|
+
}
|
|
36
|
+
function resolveOutDir(tsconfigPath, outDir) {
|
|
37
|
+
if (isAbsolute(outDir)) return outDir;
|
|
38
|
+
return resolve(dirname(tsconfigPath), outDir);
|
|
39
|
+
}
|
|
40
|
+
function isAliasOutputFile(filePath) {
|
|
41
|
+
return RELEVANT_OUTPUT_EXTENSIONS.some((ext) => filePath.endsWith(ext));
|
|
42
|
+
}
|
|
43
|
+
function isWithinDir(filePath, dirPath) {
|
|
44
|
+
const relPath = relative(dirPath, filePath);
|
|
45
|
+
return relPath === "" || !relPath.startsWith("..") && !isAbsolute(relPath);
|
|
46
|
+
}
|
|
47
|
+
async function discoverAliasTargets(entry, verbose) {
|
|
48
|
+
const loadedConfigs = /* @__PURE__ */ new Map();
|
|
49
|
+
const visited = /* @__PURE__ */ new Set();
|
|
50
|
+
const queue = [entry];
|
|
51
|
+
while (queue.length) {
|
|
52
|
+
const tsconfigPath = queue.shift();
|
|
53
|
+
if (visited.has(tsconfigPath)) continue;
|
|
54
|
+
visited.add(tsconfigPath);
|
|
55
|
+
let res;
|
|
56
|
+
try {
|
|
57
|
+
const config = parseTsconfig(tsconfigPath);
|
|
58
|
+
if (config) res = {
|
|
59
|
+
path: tsconfigPath,
|
|
60
|
+
config
|
|
61
|
+
};
|
|
62
|
+
else throw new Error("Null returned from getTsConfig");
|
|
63
|
+
} catch (error) {
|
|
64
|
+
logWarn(`Skipping unreadable config: ${formatPath(tsconfigPath)}`);
|
|
65
|
+
if (verbose) console.warn(error);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
loadedConfigs.set(res.path, res);
|
|
69
|
+
const refs = unique((res.config.references ?? []).map((ref) => {
|
|
70
|
+
return resolveTsConfigPath(resolve(dirname(res.path), ref.path));
|
|
71
|
+
}));
|
|
72
|
+
for (const refPath of refs) queue.push(refPath);
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
targets: Array.from(loadedConfigs.values()).map((res) => {
|
|
76
|
+
const outDir = res.config.compilerOptions?.outDir;
|
|
77
|
+
if (typeof outDir !== "string" || outDir.length === 0) {
|
|
78
|
+
if (verbose) logWarn(`Skipping ${formatPath(res.path)} (compilerOptions.outDir is not set)`);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
configPath: res.path,
|
|
83
|
+
outDir: resolveOutDir(res.path, outDir)
|
|
84
|
+
};
|
|
85
|
+
}).filter((target) => target !== void 0),
|
|
86
|
+
visitedConfigs: Array.from(visited)
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
async function processAliasTarget(target) {
|
|
90
|
+
if (!existsSync(target.outDir)) {
|
|
91
|
+
logWarn(`Skipping ${formatPath(target.configPath)} (missing outDir ${formatPath(target.outDir)})`);
|
|
42
92
|
return;
|
|
43
93
|
}
|
|
44
94
|
try {
|
|
45
95
|
await replaceTscAliasPaths({
|
|
46
|
-
configFile:
|
|
47
|
-
outDir:
|
|
96
|
+
configFile: target.configPath,
|
|
97
|
+
outDir: target.outDir
|
|
48
98
|
});
|
|
49
|
-
logInfo(`${colorText("green", "updated")} ${formatPath(
|
|
99
|
+
logInfo(`${colorText("green", "updated")} ${formatPath(target.outDir)} <- ${formatPath(target.configPath)}`);
|
|
50
100
|
} catch (error) {
|
|
51
|
-
logError(`Failed processing ${formatPath(
|
|
101
|
+
logError(`Failed processing ${formatPath(target.configPath)}`);
|
|
52
102
|
console.error(error);
|
|
53
103
|
}
|
|
54
104
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
105
|
+
async function syncWatcherPaths(watcher, currentPaths, nextPaths) {
|
|
106
|
+
const toUnwatch = Array.from(currentPaths).filter((filePath) => !nextPaths.has(filePath));
|
|
107
|
+
if (toUnwatch.length > 0) await watcher.unwatch(toUnwatch);
|
|
108
|
+
const toWatch = Array.from(nextPaths).filter((filePath) => !currentPaths.has(filePath));
|
|
109
|
+
if (toWatch.length > 0) watcher.add(toWatch);
|
|
110
|
+
return new Set(nextPaths);
|
|
111
|
+
}
|
|
112
|
+
function createRegenerator(entry, verbose) {
|
|
113
|
+
let isRunning = false;
|
|
114
|
+
let rerunRequested = false;
|
|
115
|
+
let watchedConfigs = /* @__PURE__ */ new Set();
|
|
116
|
+
let watchedOutputRoots = /* @__PURE__ */ new Set();
|
|
117
|
+
let syncedConfigPaths = /* @__PURE__ */ new Set();
|
|
118
|
+
let syncedOutputRoots = /* @__PURE__ */ new Set();
|
|
119
|
+
let targets = [];
|
|
120
|
+
const run = async (reason) => {
|
|
121
|
+
if (isRunning) {
|
|
122
|
+
rerunRequested = true;
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
isRunning = true;
|
|
126
|
+
try {
|
|
127
|
+
do {
|
|
128
|
+
rerunRequested = false;
|
|
129
|
+
if (reason) {
|
|
130
|
+
logInfo(`${colorText("cyan", "regenerate")} (${reason})`);
|
|
131
|
+
reason = void 0;
|
|
132
|
+
}
|
|
133
|
+
const result = await discoverAliasTargets(entry, verbose);
|
|
134
|
+
targets = result.targets;
|
|
135
|
+
watchedConfigs = new Set(result.visitedConfigs);
|
|
136
|
+
watchedOutputRoots = new Set(unique(result.targets.map((target) => dirname(target.outDir))));
|
|
137
|
+
if (targets.length === 0) logWarn("No tsconfig files with compilerOptions.outDir were found");
|
|
138
|
+
else await Promise.all(targets.map((target) => processAliasTarget(target)));
|
|
139
|
+
} while (rerunRequested);
|
|
140
|
+
} finally {
|
|
141
|
+
isRunning = false;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
const syncConfigWatcher = async (watcher) => {
|
|
145
|
+
syncedConfigPaths = await syncWatcherPaths(watcher, syncedConfigPaths, watchedConfigs);
|
|
146
|
+
};
|
|
147
|
+
const syncOutputWatcher = async (watcher) => {
|
|
148
|
+
syncedOutputRoots = await syncWatcherPaths(watcher, syncedOutputRoots, watchedOutputRoots);
|
|
149
|
+
};
|
|
150
|
+
return {
|
|
151
|
+
run,
|
|
152
|
+
syncConfigWatcher,
|
|
153
|
+
syncOutputWatcher,
|
|
154
|
+
getTargets: () => targets
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
async function main() {
|
|
158
|
+
const { values } = parseArgs({
|
|
159
|
+
args: process.argv.slice(2),
|
|
160
|
+
options: {
|
|
161
|
+
config: {
|
|
162
|
+
type: "string",
|
|
163
|
+
short: "c"
|
|
164
|
+
},
|
|
165
|
+
watch: {
|
|
166
|
+
type: "boolean",
|
|
167
|
+
short: "w"
|
|
168
|
+
},
|
|
169
|
+
verbose: {
|
|
170
|
+
type: "boolean",
|
|
171
|
+
short: "v"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
const entry = values.config ? resolve(values.config) : null;
|
|
176
|
+
if (!entry) {
|
|
177
|
+
logError("Missing required flag: --config <path/to/tsconfig.json>");
|
|
178
|
+
process.exit(1);
|
|
179
|
+
}
|
|
180
|
+
if (!existsSync(entry)) {
|
|
181
|
+
logError(`Config file not found: ${formatPath(entry)}`);
|
|
182
|
+
process.exit(1);
|
|
183
|
+
}
|
|
184
|
+
const watchMode = values.watch === true;
|
|
185
|
+
const verbose = values.verbose === true;
|
|
186
|
+
const regenerator = createRegenerator(entry, verbose);
|
|
187
|
+
await regenerator.run("initial run");
|
|
188
|
+
if (!watchMode) return;
|
|
189
|
+
logInfo("watch mode enabled");
|
|
190
|
+
const configWatcher = watch([], {
|
|
61
191
|
persistent: true,
|
|
62
192
|
ignoreInitial: true,
|
|
63
193
|
awaitWriteFinish: {
|
|
@@ -65,67 +195,75 @@ function watchDistFolder(distFolder) {
|
|
|
65
195
|
pollInterval: 100
|
|
66
196
|
}
|
|
67
197
|
});
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
198
|
+
const outputWatcher = watch([], {
|
|
199
|
+
persistent: true,
|
|
200
|
+
ignoreInitial: true,
|
|
201
|
+
awaitWriteFinish: {
|
|
202
|
+
stabilityThreshold: 300,
|
|
203
|
+
pollInterval: 100
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
await regenerator.syncConfigWatcher(configWatcher);
|
|
207
|
+
await regenerator.syncOutputWatcher(outputWatcher);
|
|
208
|
+
const pending = /* @__PURE__ */ new Map();
|
|
209
|
+
const scheduleTarget = (target, reason) => {
|
|
210
|
+
const key = `${target.configPath}::${target.outDir}`;
|
|
211
|
+
const existing = pending.get(key);
|
|
212
|
+
if (existing) clearTimeout(existing);
|
|
213
|
+
pending.set(key, setTimeout(() => {
|
|
214
|
+
pending.delete(key);
|
|
215
|
+
processAliasTarget(target);
|
|
216
|
+
if (verbose) logInfo(`${colorText("cyan", "reprocess")} (${reason})`);
|
|
217
|
+
}, 200));
|
|
74
218
|
};
|
|
75
|
-
|
|
76
|
-
|
|
219
|
+
const scheduleTargetsForPath = (filePath, reason) => {
|
|
220
|
+
const resolvedPath = resolve(filePath);
|
|
221
|
+
for (const target of regenerator.getTargets()) {
|
|
222
|
+
if (resolvedPath === target.outDir) {
|
|
223
|
+
scheduleTarget(target, reason);
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
if (isAliasOutputFile(resolvedPath) && isWithinDir(resolvedPath, target.outDir)) scheduleTarget(target, reason);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
configWatcher.on("change", async (filePath) => {
|
|
230
|
+
logInfo(`${colorText("cyan", "change")} ${formatPath(filePath)}`);
|
|
231
|
+
await regenerator.run(`changed ${relative(process.cwd(), filePath)}`);
|
|
232
|
+
await regenerator.syncConfigWatcher(configWatcher);
|
|
233
|
+
await regenerator.syncOutputWatcher(outputWatcher);
|
|
234
|
+
});
|
|
235
|
+
configWatcher.on("add", async (filePath) => {
|
|
236
|
+
logInfo(`${colorText("cyan", "add")} ${formatPath(filePath)}`);
|
|
237
|
+
await regenerator.run(`added ${relative(process.cwd(), filePath)}`);
|
|
238
|
+
await regenerator.syncConfigWatcher(configWatcher);
|
|
239
|
+
await regenerator.syncOutputWatcher(outputWatcher);
|
|
240
|
+
});
|
|
241
|
+
configWatcher.on("unlink", async (filePath) => {
|
|
242
|
+
logInfo(`${colorText("yellow", "remove")} ${formatPath(filePath)}`);
|
|
243
|
+
await regenerator.run(`removed ${relative(process.cwd(), filePath)}`);
|
|
244
|
+
await regenerator.syncConfigWatcher(configWatcher);
|
|
245
|
+
await regenerator.syncOutputWatcher(outputWatcher);
|
|
246
|
+
});
|
|
247
|
+
outputWatcher.on("addDir", (dirPath) => {
|
|
248
|
+
scheduleTargetsForPath(dirPath, `created ${relative(process.cwd(), dirPath)}`);
|
|
249
|
+
});
|
|
250
|
+
outputWatcher.on("add", (filePath) => {
|
|
251
|
+
scheduleTargetsForPath(filePath, `added ${relative(process.cwd(), filePath)}`);
|
|
77
252
|
});
|
|
78
|
-
|
|
79
|
-
|
|
253
|
+
outputWatcher.on("change", (filePath) => {
|
|
254
|
+
scheduleTargetsForPath(filePath, `changed ${relative(process.cwd(), filePath)}`);
|
|
80
255
|
});
|
|
81
|
-
return watcher;
|
|
82
256
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const distFolders = await findDistFolders(baseDir);
|
|
87
|
-
if (distFolders.length > 0) {
|
|
88
|
-
logInfo(`found ${distFolders.length} dist folder(s)`);
|
|
89
|
-
await Promise.all(distFolders.map(async (folder) => {
|
|
90
|
-
return await processDistFolder(folder);
|
|
91
|
-
}));
|
|
92
|
-
} else logInfo("no dist folders found");
|
|
93
|
-
if (watchMode) {
|
|
94
|
-
logInfo("watch mode enabled");
|
|
95
|
-
distFolders.forEach(watchDistFolder);
|
|
96
|
-
logInfo("watching for new dist folders...");
|
|
97
|
-
watch(baseDir, {
|
|
98
|
-
persistent: true,
|
|
99
|
-
ignoreInitial: true,
|
|
100
|
-
depth: 5,
|
|
101
|
-
ignored: [
|
|
102
|
-
"**/node_modules/**",
|
|
103
|
-
"**/\\.git/**",
|
|
104
|
-
"**/\\.vscode/**",
|
|
105
|
-
"**/\\.idea/**",
|
|
106
|
-
"**/coverage/**",
|
|
107
|
-
"**/build/**",
|
|
108
|
-
"**/cdk.out/**",
|
|
109
|
-
...distFolders.map((folder) => `${folder}/**`)
|
|
110
|
-
]
|
|
111
|
-
}).on("addDir", async (dirPath) => {
|
|
112
|
-
if (basename(dirPath) === "dist") {
|
|
113
|
-
if (!distFolders.includes(dirPath)) {
|
|
114
|
-
logInfo(`${colorText("cyan", "new dist")} ${formatPath(dirPath)}`);
|
|
115
|
-
distFolders.push(dirPath);
|
|
116
|
-
await processDistFolder(dirPath);
|
|
117
|
-
watchDistFolder(dirPath);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
}
|
|
257
|
+
function isDirectExecution() {
|
|
258
|
+
if (!process.argv[1]) return false;
|
|
259
|
+
return resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
122
260
|
}
|
|
123
|
-
main().catch((error) => {
|
|
261
|
+
if (isDirectExecution()) main().catch((error) => {
|
|
124
262
|
logError("Unhandled error in ts-alias script");
|
|
125
263
|
console.error(error);
|
|
126
264
|
process.exit(1);
|
|
127
265
|
});
|
|
128
266
|
//#endregion
|
|
129
|
-
export {};
|
|
267
|
+
export { createRegenerator, discoverAliasTargets, isAliasOutputFile, isWithinDir, main, processAliasTarget, resolveOutDir, resolveTsConfigPath, syncWatcherPaths, unique };
|
|
130
268
|
|
|
131
269
|
//# sourceMappingURL=ts-alias.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-alias.mjs","names":[],"sources":["../../src/scripts/ts-alias.ts"],"sourcesContent":["#!/usr/bin/env bun\n\nimport console from 'console';\n// NOTE: dont use aliases here cause this file needs to be compiled first\nimport { existsSync } from 'fs';\nimport { dirname, join, basename, relative } from 'path';\n\nimport type { FSWatcher } from 'chokidar';\nimport { watch } from 'chokidar';\nimport { glob } from 'glob';\nimport { replaceTscAliasPaths } from 'tsc-alias';\n\nimport { colorText } from '../utils/cli.js';\n\n// Parse command-line arguments\nconst args = process.argv.slice(2);\nconst watchMode = args.includes('-w') || args.includes('--watch');\nconst LABEL = colorText('cyan', '[ts-alias]');\n\nconst formatPath = (filePath: string): string => colorText('dim', relative(process.cwd(), filePath));\nconst logInfo = (message: string): void => console.log(`${LABEL} ${message}`);\nconst logWarn = (message: string): void => console.warn(`${LABEL} ${colorText('yellow', message)}`);\nconst logError = (message: string): void => console.error(`${LABEL} ${colorText('red', message)}`);\n\n/**\n * Find all dist folders in the project directory, excluding certain patterns.\n */\nasync function findDistFolders(baseDir: string): Promise<string[]> {\n const ignorePatterns = [\n '**/node_modules/**',\n '**/\\\\.git/**',\n '**/\\\\.vscode/**',\n '**/\\\\.idea/**',\n '**/coverage/**',\n '**/build/**',\n '**/cdk.out/**'\n ];\n\n const distFolders = await glob('**/dist', { cwd: baseDir, ignore: ignorePatterns, absolute: true });\n\n return distFolders;\n}\n\n/**\n * Process the dist folder by replacing TypeScript alias paths with relative paths.\n */\nasync function processDistFolder(distFolder: string): Promise<void> {\n const projectRoot = dirname(distFolder);\n const tsconfigPath = join(projectRoot, 'tsconfig.json');\n\n if (!existsSync(tsconfigPath)) {\n logWarn(`No tsconfig.json at ${formatPath(tsconfigPath)}`);\n return;\n }\n\n try {\n await replaceTscAliasPaths({ configFile: tsconfigPath, outDir: distFolder });\n logInfo(`${colorText('green', 'updated')} ${formatPath(distFolder)}`);\n } catch (error) {\n logError(`Failed processing ${formatPath(distFolder)}`);\n console.error(error);\n }\n}\n\n/**\n * Watch the dist folder for changes and process it when files are added or changed.\n */\nfunction watchDistFolder(distFolder: string): FSWatcher {\n let pending: ReturnType<typeof setTimeout> | null = null;\n\n const watcher = watch(distFolder, {\n persistent: true,\n ignoreInitial: true,\n awaitWriteFinish: { stabilityThreshold: 300, pollInterval: 100 }\n });\n\n const scheduleProcess = (): void => {\n if (pending) clearTimeout(pending);\n pending = setTimeout(() => {\n pending = null;\n void processDistFolder(distFolder);\n }, 200);\n };\n\n watcher.on('add', (filePath) => {\n if (filePath.endsWith('.js') || filePath.endsWith('.jsx')) {\n scheduleProcess();\n }\n });\n\n watcher.on('change', (filePath) => {\n if (filePath.endsWith('.js') || filePath.endsWith('.jsx')) {\n scheduleProcess();\n }\n });\n\n return watcher;\n}\n\n// Main function\nasync function main(): Promise<void> {\n const baseDir = process.cwd();\n logInfo(`searching ${colorText('cyan', 'dist')} folders in ${formatPath(baseDir)}`);\n\n const distFolders = await findDistFolders(baseDir);\n\n // Process all folders initially if any exist\n if (distFolders.length > 0) {\n logInfo(`found ${distFolders.length} dist folder(s)`);\n\n await Promise.all(\n distFolders.map(async (folder) => {\n return await processDistFolder(folder);\n })\n );\n } else {\n logInfo('no dist folders found');\n }\n\n // Set up watchers if in watch mode\n if (watchMode) {\n logInfo('watch mode enabled');\n\n // Set up watchers for existing dist folders\n distFolders.forEach(watchDistFolder);\n\n // Watch for new dist folders being created\n logInfo('watching for new dist folders...');\n const dirWatcher = watch(baseDir, {\n persistent: true,\n ignoreInitial: true,\n depth: 5, // Adjust depth as needed for your project structure\n ignored: [\n '**/node_modules/**',\n '**/\\\\.git/**',\n '**/\\\\.vscode/**',\n '**/\\\\.idea/**',\n '**/coverage/**',\n '**/build/**',\n '**/cdk.out/**',\n // Don't watch the contents of existing dist folders (they'll be watched separately)\n ...distFolders.map((folder) => `${folder}/**`)\n ]\n });\n\n // Handle directory creation events\n dirWatcher.on('addDir', async (dirPath) => {\n if (basename(dirPath) === 'dist') {\n // Make sure it's not already being watched\n if (!distFolders.includes(dirPath)) {\n logInfo(`${colorText('cyan', 'new dist')} ${formatPath(dirPath)}`);\n distFolders.push(dirPath);\n await processDistFolder(dirPath);\n watchDistFolder(dirPath);\n }\n }\n });\n }\n}\n\nmain().catch((error) => {\n logError('Unhandled error in ts-alias script');\n console.error(error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;AAeA,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE;AAClC,MAAM,YAAY,KAAK,SAAS,KAAK,IAAI,KAAK,SAAS,UAAU;AACjE,MAAM,QAAQ,UAAU,QAAQ,aAAa;AAE7C,MAAM,cAAc,aAA6B,UAAU,OAAO,SAAS,QAAQ,KAAK,EAAE,SAAS,CAAC;AACpG,MAAM,WAAW,YAA0B,QAAQ,IAAI,GAAG,MAAM,GAAG,UAAU;AAC7E,MAAM,WAAW,YAA0B,QAAQ,KAAK,GAAG,MAAM,GAAG,UAAU,UAAU,QAAQ,GAAG;AACnG,MAAM,YAAY,YAA0B,QAAQ,MAAM,GAAG,MAAM,GAAG,UAAU,OAAO,QAAQ,GAAG;;;;AAKlG,eAAe,gBAAgB,SAAoC;AAajE,QAFoB,MAAM,KAAK,WAAW;EAAE,KAAK;EAAS,QAVnC;GACrB;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EAEiF,UAAU;EAAM,CAAC;;;;;AAQrG,eAAe,kBAAkB,YAAmC;CAElE,MAAM,eAAe,KADD,QAAQ,WAAW,EACA,gBAAgB;AAEvD,KAAI,CAAC,WAAW,aAAa,EAAE;AAC7B,UAAQ,uBAAuB,WAAW,aAAa,GAAG;AAC1D;;AAGF,KAAI;AACF,QAAM,qBAAqB;GAAE,YAAY;GAAc,QAAQ;GAAY,CAAC;AAC5E,UAAQ,GAAG,UAAU,SAAS,UAAU,CAAC,GAAG,WAAW,WAAW,GAAG;UAC9D,OAAO;AACd,WAAS,qBAAqB,WAAW,WAAW,GAAG;AACvD,UAAQ,MAAM,MAAM;;;;;;A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U,QAAQ,WAAW,CAAC,GAAG,WAAW,QAAQ,GAAG;AAClE,iBAAY,KAAK,QAAQ;AACzB,WAAM,kBAAkB,QAAQ;AAChC,qBAAgB,QAAQ;;;IAG5B;;;AAIN,MAAM,CAAC,OAAO,UAAU;AACtB,UAAS,qCAAqC;AAC9C,SAAQ,MAAM,MAAM;AACpB,SAAQ,KAAK,EAAE;EACf"}
|
|
1
|
+
{"version":3,"file":"ts-alias.mjs","names":[],"sources":["../../src/scripts/ts-alias.ts"],"sourcesContent":["#!/usr/bin/env bun\n\nimport console from 'console';\n// NOTE: dont use aliases here cause this file needs to be compiled first\nimport { existsSync } from 'fs';\nimport { dirname, isAbsolute, relative, resolve } from 'path';\nimport { fileURLToPath } from 'url';\nimport { parseArgs } from 'util';\n\nimport type { FSWatcher } from 'chokidar';\nimport { watch } from 'chokidar';\nimport { type TsConfigResult, parseTsconfig } from 'get-tsconfig';\nimport { replaceTscAliasPaths } from 'tsc-alias';\n\nimport { colorText } from '../utils/cli.js';\n\nconst RELEVANT_OUTPUT_EXTENSIONS = ['.js', '.jsx', '.mjs', '.cjs', '.d.ts', '.d.mts', '.d.cts'];\n\nconst LABEL = colorText('cyan', '[ts-alias]');\nconst formatPath = (filePath: string): string => colorText('dim', relative(process.cwd(), filePath));\nconst logInfo = (message: string): void => console.log(`${LABEL} ${message}`);\nconst logWarn = (message: string): void => console.warn(`${LABEL} ${colorText('yellow', message)}`);\nconst logError = (message: string): void => console.error(`${LABEL} ${colorText('red', message)}`);\n\nexport type AliasTarget = { configPath: string; outDir: string };\n\nexport function unique(items: string[]): string[] {\n return Array.from(new Set(items));\n}\n\n/**\n * If the path refers to a file then it returns it otherwise joins tsconfig.json\n */\nexport function resolveTsConfigPath(refAbsPath: string): string {\n if (refAbsPath.endsWith('.json')) return refAbsPath;\n return resolve(refAbsPath, 'tsconfig.json');\n}\n\nexport function resolveOutDir(tsconfigPath: string, outDir: string): string {\n if (isAbsolute(outDir)) return outDir;\n return resolve(dirname(tsconfigPath), outDir);\n}\n\nexport function isAliasOutputFile(filePath: string): boolean {\n return RELEVANT_OUTPUT_EXTENSIONS.some((ext) => filePath.endsWith(ext));\n}\n\nexport function isWithinDir(filePath: string, dirPath: string): boolean {\n const relPath = relative(dirPath, filePath);\n return relPath === '' || (!relPath.startsWith('..') && !isAbsolute(relPath));\n}\n\nexport async function discoverAliasTargets(\n entry: string,\n verbose: boolean\n): Promise<{ targets: AliasTarget[]; visitedConfigs: string[] }> {\n const loadedConfigs = new Map<string, TsConfigResult>();\n const visited = new Set<string>();\n const queue: string[] = [entry];\n\n while (queue.length) {\n const tsconfigPath = queue.shift()!;\n if (visited.has(tsconfigPath)) continue;\n visited.add(tsconfigPath);\n\n let res: TsConfigResult;\n\n try {\n const config = parseTsconfig(tsconfigPath);\n if (config) res = { path: tsconfigPath, config };\n else throw new Error('Null returned from getTsConfig');\n } catch (error) {\n logWarn(`Skipping unreadable config: ${formatPath(tsconfigPath)}`);\n if (verbose) console.warn(error);\n continue;\n }\n\n loadedConfigs.set(res.path, res);\n\n const refs = unique(\n (res.config.references ?? []).map((ref) => {\n const absPath = resolve(dirname(res.path), ref.path);\n return resolveTsConfigPath(absPath);\n })\n );\n\n for (const refPath of refs) queue.push(refPath);\n }\n\n const targets = Array.from(loadedConfigs.values())\n .map((res): AliasTarget | undefined => {\n const outDir = res.config.compilerOptions?.outDir;\n if (typeof outDir !== 'string' || outDir.length === 0) {\n if (verbose) logWarn(`Skipping ${formatPath(res.path)} (compilerOptions.outDir is not set)`);\n return undefined;\n }\n\n return { configPath: res.path, outDir: resolveOutDir(res.path, outDir) };\n })\n .filter((target): target is AliasTarget => target !== undefined);\n\n return { targets, visitedConfigs: Array.from(visited) };\n}\n\nexport async function processAliasTarget(target: AliasTarget): Promise<void> {\n if (!existsSync(target.outDir)) {\n logWarn(`Skipping ${formatPath(target.configPath)} (missing outDir ${formatPath(target.outDir)})`);\n return;\n }\n\n try {\n await replaceTscAliasPaths({ configFile: target.configPath, outDir: target.outDir });\n logInfo(`${colorText('green', 'updated')} ${formatPath(target.outDir)} <- ${formatPath(target.configPath)}`);\n } catch (error) {\n logError(`Failed processing ${formatPath(target.configPath)}`);\n console.error(error);\n }\n}\n\nexport async function syncWatcherPaths(\n watcher: FSWatcher,\n currentPaths: Set<string>,\n nextPaths: Set<string>\n): Promise<Set<string>> {\n const toUnwatch = Array.from(currentPaths).filter((filePath) => !nextPaths.has(filePath));\n if (toUnwatch.length > 0) await watcher.unwatch(toUnwatch);\n\n const toWatch = Array.from(nextPaths).filter((filePath) => !currentPaths.has(filePath));\n if (toWatch.length > 0) watcher.add(toWatch);\n\n return new Set(nextPaths);\n}\n\nexport function createRegenerator(\n entry: string,\n verbose: boolean\n): {\n run: (reason?: string) => Promise<void>;\n syncConfigWatcher: (watcher: FSWatcher) => Promise<void>;\n syncOutputWatcher: (watcher: FSWatcher) => Promise<void>;\n getTargets: () => AliasTarget[];\n} {\n let isRunning = false;\n let rerunRequested = false;\n let watchedConfigs = new Set<string>();\n let watchedOutputRoots = new Set<string>();\n let syncedConfigPaths = new Set<string>();\n let syncedOutputRoots = new Set<string>();\n let targets: AliasTarget[] = [];\n\n const run = async (reason?: string): Promise<void> => {\n if (isRunning) {\n rerunRequested = true;\n return;\n }\n isRunning = true;\n\n try {\n do {\n rerunRequested = false;\n if (reason) {\n logInfo(`${colorText('cyan', 'regenerate')} (${reason})`);\n reason = undefined;\n }\n\n const result = await discoverAliasTargets(entry, verbose);\n targets = result.targets;\n watchedConfigs = new Set(result.visitedConfigs);\n watchedOutputRoots = new Set(unique(result.targets.map((target) => dirname(target.outDir))));\n\n if (targets.length === 0) {\n logWarn('No tsconfig files with compilerOptions.outDir were found');\n } else {\n await Promise.all(targets.map((target) => processAliasTarget(target)));\n }\n } while (rerunRequested);\n } finally {\n isRunning = false;\n }\n };\n\n const syncConfigWatcher = async (watcher: FSWatcher): Promise<void> => {\n syncedConfigPaths = await syncWatcherPaths(watcher, syncedConfigPaths, watchedConfigs);\n };\n\n const syncOutputWatcher = async (watcher: FSWatcher): Promise<void> => {\n syncedOutputRoots = await syncWatcherPaths(watcher, syncedOutputRoots, watchedOutputRoots);\n };\n\n return { run, syncConfigWatcher, syncOutputWatcher, getTargets: () => targets };\n}\n\n// Main function\nexport async function main(): Promise<void> {\n const { values } = parseArgs({\n args: process.argv.slice(2),\n options: {\n config: { type: 'string', short: 'c' },\n watch: { type: 'boolean', short: 'w' },\n verbose: { type: 'boolean', short: 'v' }\n }\n });\n\n const entry = values.config ? resolve(values.config) : null;\n if (!entry) {\n logError('Missing required flag: --config <path/to/tsconfig.json>');\n process.exit(1);\n }\n if (!existsSync(entry)) {\n logError(`Config file not found: ${formatPath(entry)}`);\n process.exit(1);\n }\n\n const watchMode = values.watch === true;\n const verbose = values.verbose === true;\n const regenerator = createRegenerator(entry, verbose);\n\n await regenerator.run('initial run');\n\n if (!watchMode) return;\n\n logInfo('watch mode enabled');\n const configWatcher = watch([], {\n persistent: true,\n ignoreInitial: true,\n awaitWriteFinish: { stabilityThreshold: 300, pollInterval: 100 }\n });\n const outputWatcher = watch([], {\n persistent: true,\n ignoreInitial: true,\n awaitWriteFinish: { stabilityThreshold: 300, pollInterval: 100 }\n });\n\n await regenerator.syncConfigWatcher(configWatcher);\n await regenerator.syncOutputWatcher(outputWatcher);\n\n const pending = new Map<string, ReturnType<typeof setTimeout>>();\n const scheduleTarget = (target: AliasTarget, reason: string): void => {\n const key = `${target.configPath}::${target.outDir}`;\n const existing = pending.get(key);\n if (existing) clearTimeout(existing);\n\n pending.set(\n key,\n setTimeout(() => {\n pending.delete(key);\n void processAliasTarget(target);\n if (verbose) logInfo(`${colorText('cyan', 'reprocess')} (${reason})`);\n }, 200)\n );\n };\n\n const scheduleTargetsForPath = (filePath: string, reason: string): void => {\n const resolvedPath = resolve(filePath);\n\n for (const target of regenerator.getTargets()) {\n if (resolvedPath === target.outDir) {\n scheduleTarget(target, reason);\n continue;\n }\n if (isAliasOutputFile(resolvedPath) && isWithinDir(resolvedPath, target.outDir)) {\n scheduleTarget(target, reason);\n }\n }\n };\n\n configWatcher.on('change', async (filePath) => {\n logInfo(`${colorText('cyan', 'change')} ${formatPath(filePath)}`);\n await regenerator.run(`changed ${relative(process.cwd(), filePath)}`);\n await regenerator.syncConfigWatcher(configWatcher);\n await regenerator.syncOutputWatcher(outputWatcher);\n });\n\n configWatcher.on('add', async (filePath) => {\n logInfo(`${colorText('cyan', 'add')} ${formatPath(filePath)}`);\n await regenerator.run(`added ${relative(process.cwd(), filePath)}`);\n await regenerator.syncConfigWatcher(configWatcher);\n await regenerator.syncOutputWatcher(outputWatcher);\n });\n\n configWatcher.on('unlink', async (filePath) => {\n logInfo(`${colorText('yellow', 'remove')} ${formatPath(filePath)}`);\n await regenerator.run(`removed ${relative(process.cwd(), filePath)}`);\n await regenerator.syncConfigWatcher(configWatcher);\n await regenerator.syncOutputWatcher(outputWatcher);\n });\n\n outputWatcher.on('addDir', (dirPath) => {\n scheduleTargetsForPath(dirPath, `created ${relative(process.cwd(), dirPath)}`);\n });\n\n outputWatcher.on('add', (filePath) => {\n scheduleTargetsForPath(filePath, `added ${relative(process.cwd(), filePath)}`);\n });\n\n outputWatcher.on('change', (filePath) => {\n scheduleTargetsForPath(filePath, `changed ${relative(process.cwd(), filePath)}`);\n });\n}\n\nfunction isDirectExecution(): boolean {\n if (!process.argv[1]) return false;\n return resolve(process.argv[1]) === fileURLToPath(import.meta.url);\n}\n\nif (isDirectExecution()) {\n main().catch((error) => {\n logError('Unhandled error in ts-alias script');\n console.error(error);\n process.exit(1);\n });\n}\n"],"mappings":";;;;;;;;;;;AAgBA,MAAM,6BAA6B;CAAC;CAAO;CAAQ;CAAQ;CAAQ;CAAS;CAAU;CAAS;AAE/F,MAAM,QAAQ,UAAU,QAAQ,aAAa;AAC7C,MAAM,cAAc,aAA6B,UAAU,OAAO,SAAS,QAAQ,KAAK,EAAE,SAAS,CAAC;AACpG,MAAM,WAAW,YAA0B,QAAQ,IAAI,GAAG,MAA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GAC9E;AAEF,eAAc,GAAG,WAAW,aAAa;AACvC,yBAAuB,UAAU,WAAW,SAAS,QAAQ,KAAK,EAAE,SAAS,GAAG;GAChF;;AAGJ,SAAS,oBAA6B;AACpC,KAAI,CAAC,QAAQ,KAAK,GAAI,QAAO;AAC7B,QAAO,QAAQ,QAAQ,KAAK,GAAG,KAAK,cAAc,OAAO,KAAK,IAAI;;AAGpE,IAAI,mBAAmB,CACrB,OAAM,CAAC,OAAO,UAAU;AACtB,UAAS,qCAAqC;AAC9C,SAAQ,MAAM,MAAM;AACpB,SAAQ,KAAK,EAAE;EACf"}
|
|
@@ -1 +1,49 @@
|
|
|
1
|
-
|
|
1
|
+
import { FSWatcher } from "chokidar";
|
|
2
|
+
import { TsConfigJson, TsConfigResult } from "get-tsconfig";
|
|
3
|
+
|
|
4
|
+
//#region src/scripts/ts-build-config.d.ts
|
|
5
|
+
declare const GENERATED_FILE_HEADER = "// generated by ts-build-config";
|
|
6
|
+
declare function unique(items: string[]): string[];
|
|
7
|
+
/**
|
|
8
|
+
* If the path refers to a file then it returns it otherwise joins tsconfig.json
|
|
9
|
+
*/
|
|
10
|
+
declare function resolveTsConfigPath(refAbsPath: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Excludes extra paths from the include list that contain test patterns
|
|
13
|
+
*/
|
|
14
|
+
declare function computeExtraExcludes(config: TsConfigJson): string[];
|
|
15
|
+
declare function withTrailingNewline(value: string): string;
|
|
16
|
+
declare function formatBuildTsconfigJson(config: TsConfigJson): Promise<string>;
|
|
17
|
+
declare function writeBuildTsconfig(tsconfigPath: string, config: TsConfigJson, dryRun: boolean): Promise<string>;
|
|
18
|
+
declare function isGeneratedByThisScript(filePath: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* @returns true if the tsconfig path should have a build config generated for it
|
|
21
|
+
*/
|
|
22
|
+
declare function shouldUseBuildConfig(tsconfigPath: string, force: boolean): boolean;
|
|
23
|
+
declare function ensureDotRelative(filePath: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the modified tsconfig where the references point to the build configs
|
|
26
|
+
* (that we are going to build)
|
|
27
|
+
*/
|
|
28
|
+
declare function replaceRefsWithBuildConfigs(res: TsConfigResult, buildConfigSet: Set<string>, remove: string[]): TsConfigJson;
|
|
29
|
+
type GenerateOptions = {
|
|
30
|
+
dryRun: boolean;
|
|
31
|
+
force: boolean;
|
|
32
|
+
verbose: boolean;
|
|
33
|
+
remove: string[];
|
|
34
|
+
};
|
|
35
|
+
declare function generateBuildConfigs(entry: string, options: GenerateOptions): Promise<{
|
|
36
|
+
created: {
|
|
37
|
+
src: string;
|
|
38
|
+
out: string;
|
|
39
|
+
}[];
|
|
40
|
+
visitedConfigs: string[];
|
|
41
|
+
}>;
|
|
42
|
+
declare function createRegenerator(entry: string, options: GenerateOptions): {
|
|
43
|
+
run: (reason?: string) => Promise<void>;
|
|
44
|
+
syncWatchedConfigs: (watcher: FSWatcher) => void;
|
|
45
|
+
};
|
|
46
|
+
declare function main(): Promise<void>;
|
|
47
|
+
//#endregion
|
|
48
|
+
export { GENERATED_FILE_HEADER, GenerateOptions, computeExtraExcludes, createRegenerator, ensureDotRelative, formatBuildTsconfigJson, generateBuildConfigs, isGeneratedByThisScript, main, replaceRefsWithBuildConfigs, resolveTsConfigPath, shouldUseBuildConfig, unique, withTrailingNewline, writeBuildTsconfig };
|
|
49
|
+
//# sourceMappingURL=ts-build-config.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-build-config.d.mts","names":[],"sources":["../../src/scripts/ts-build-config.ts"],"mappings":";;;;cAyBa,qBAAA;AAAA,iBAQG,MAAA,CAAO,KAAA;;;;iBAOP,mBAAA,CAAoB,UAAA;AAPpC;;;AAAA,iBAegB,oBAAA,CAAqB,MAAA,EAAQ,YAAA;AAAA,iBAe7B,mBAAA,CAAoB,KAAA;AAAA,iBAId,uBAAA,CAAwB,MAAA,EAAQ,YAAA,GAAe,OAAA;AAAA,iBAyB/C,kBAAA,CAAmB,YAAA,UAAsB,MAAA,EAAQ,YAAA,EAAc,MAAA,YAAkB,OAAA;AAAA,iBA0BvF,uBAAA,CAAwB,QAAA;;;AAtExC;iBAoFgB,oBAAA,CAAqB,YAAA,UAAsB,KAAA;AAAA,iBAO3C,iBAAA,CAAkB,QAAA;;;AA5ElC;;iBAqFgB,2BAAA,CACd,GAAA,EAAK,cAAA,EACL,cAAA,EAAgB,GAAA,UAChB,MAAA,aACC,YAAA;AAAA,KA8BS,eAAA;EAAoB,MAAA;EAAiB,KAAA;EAAgB,OAAA;EAAkB,MAAA;AAAA;AAAA,iBAE7D,oBAAA,CACpB,KAAA,UACA,OAAA,EAAS,eAAA,GACR,OAAA;EAAU,OAAA;IAAW,GAAA;IAAa,GAAA;EAAA;EAAiB,cAAA;AAAA;AAAA,iBAmEtC,iBAAA,CACd,KAAA,UACA,OAAA,EAAS,eAAA;EACN,GAAA,GAAM,MAAA,cAAoB,OAAA;EAAe,kBAAA,GAAqB,OAAA,EAAS,SAAA;AAAA;AAAA,iBAmCtD,IAAA,CAAA,GAAQ,OAAA"}
|
|
@@ -4,6 +4,7 @@ import { dirname, isAbsolute, join, relative, resolve } from "path";
|
|
|
4
4
|
import { parseArgs } from "util";
|
|
5
5
|
import console from "console";
|
|
6
6
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
7
|
+
import { fileURLToPath } from "url";
|
|
7
8
|
import { watch } from "chokidar";
|
|
8
9
|
import { parseTsconfig } from "get-tsconfig";
|
|
9
10
|
import { format } from "oxfmt";
|
|
@@ -281,12 +282,16 @@ async function main() {
|
|
|
281
282
|
regenerator.syncWatchedConfigs(watcher);
|
|
282
283
|
});
|
|
283
284
|
}
|
|
284
|
-
|
|
285
|
+
function isDirectExecution() {
|
|
286
|
+
if (!process.argv[1]) return false;
|
|
287
|
+
return resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
288
|
+
}
|
|
289
|
+
if (isDirectExecution()) main().catch((err) => {
|
|
285
290
|
logError("Unhandled error");
|
|
286
291
|
console.error(err);
|
|
287
292
|
process.exit(1);
|
|
288
293
|
});
|
|
289
294
|
//#endregion
|
|
290
|
-
export {};
|
|
295
|
+
export { GENERATED_FILE_HEADER, computeExtraExcludes, createRegenerator, ensureDotRelative, formatBuildTsconfigJson, generateBuildConfigs, isGeneratedByThisScript, main, replaceRefsWithBuildConfigs, resolveTsConfigPath, shouldUseBuildConfig, unique, withTrailingNewline, writeBuildTsconfig };
|
|
291
296
|
|
|
292
297
|
//# sourceMappingURL=ts-build-config.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-build-config.mjs","names":["formatWithOxfmt"],"sources":["../../src/scripts/ts-build-config.ts"],"sourcesContent":["#!/usr/bin/env bun\n\nimport console from 'console';\nimport { mkdirSync, writeFileSync, existsSync, readFileSync } from 'fs';\nimport { dirname, join, resolve, relative, isAbsolute } from 'path';\nimport { parseArgs } from 'util';\n\nimport type { FSWatcher } from 'chokidar';\nimport { watch } from 'chokidar';\nimport { type TsConfigResult, type TsConfigJson, parseTsconfig } from 'get-tsconfig';\nimport { format as formatWithOxfmt } from 'oxfmt';\n\nimport { colorText } from '../utils/cli.js';\n\n// TODO on startup check cwd for oxfmt config and use that instead of my default\n\nconst DEFAULT_TEST_EXCLUDES = [\n '**/*.test.ts',\n '**/*.test.tsx',\n '**/*.spec.ts',\n '**/*.spec.tsx',\n '**/__tests__/**',\n '**/tests/**'\n];\nconst GENERATED_FILE_HEADER = '// generated by ts-build-config';\n\nconst LABEL = colorText('cyan', '[ts-build-config]');\nconst formatPath = (filePath: string): string => colorText('dim', relative(process.cwd(), filePath));\nconst logInfo = (message: string): void => console.log(`${LABEL} ${message}`);\nconst logWarn = (message: string): void => console.warn(`${LABEL} ${colorText('yellow', message)}`);\nconst logError = (message: string): void => console.error(`${LABEL} ${colorText('red', message)}`);\n\nfunction unique(items: string[]): string[] {\n return Array.from(new Set(items));\n}\n\n/**\n * If the path refers to a file then it returns it otherwise joins tsconfig.json\n */\nfunction resolveTsConfigPath(refAbsPath: string): string {\n if (refAbsPath.endsWith('.json')) return refAbsPath;\n else return join(refAbsPath, 'tsconfig.json');\n}\n\n/**\n * Excludes extra paths from the include list that contain test patterns\n */\nfunction computeExtraExcludes(config: TsConfigJson): string[] {\n const extra: string[] = [...DEFAULT_TEST_EXCLUDES];\n\n // If the tsconfig includes ./tests (or tests) explicitly, ensure it is excluded in build config.\n for (const inc of config.include ?? []) {\n const norm = inc.replace(/\\\\/g, '/').replace(/\\/+$/, '');\n if (norm === './tests' || norm === 'tests' || norm.startsWith('./tests/') || norm.startsWith('tests/')) {\n extra.push('./tests/**');\n break;\n }\n }\n\n return unique(extra);\n}\n\nfunction withTrailingNewline(value: string): string {\n return value.endsWith('\\n') ? value : `${value}\\n`;\n}\n\nasync function formatBuildTsconfigJson(config: TsConfigJson): Promise<string> {\n const fallback = JSON.stringify(config, null, 2);\n\n try {\n const result = await formatWithOxfmt('tsconfig.build.json', fallback, {\n useTabs: false,\n singleQuote: true,\n trailingComma: 'none',\n printWidth: 120,\n objectWrap: 'collapse',\n semi: true,\n proseWrap: 'always',\n sortPackageJson: { sortScripts: true },\n sortImports: {}\n });\n if (!result.errors.length && typeof result.code === 'string' && result.code.length > 0) {\n return withTrailingNewline(result.code);\n }\n } catch {\n // Fallback to plain JSON below.\n }\n\n return withTrailingNewline(fallback);\n}\n\nasync function writeBuildTsconfig(tsconfigPath: string, config: TsConfigJson, dryRun: boolean): Promise<string> {\n const dir = dirname(tsconfigPath);\n const outPath = join(dir, 'tsconfig.build.json');\n\n const mergedExclude = unique([...(config.exclude ?? []), ...computeExtraExcludes(config)]);\n\n const buildConfig: TsConfigJson = { extends: './tsconfig.json', compilerOptions: {}, exclude: mergedExclude };\n\n if (config.references && config.references.length > 0) buildConfig.references = config.references;\n\n // If original compilerOptions exists, keep build-specific overrides minimal.\n // But ensure emit is enabled if base tsconfig has noEmit: true (common for editor configs).\n if (config.compilerOptions?.noEmit === true) buildConfig.compilerOptions!.noEmit = false;\n\n // Keep outDir/rootDir if already set in base; do not guess.\n // If you want to force them, do it in the base tsconfig.json or pass flags later.\n\n if (!dryRun) {\n mkdirSync(dir, { recursive: true });\n const formattedJson = await formatBuildTsconfigJson(buildConfig);\n writeFileSync(outPath, `${GENERATED_FILE_HEADER}\\n${formattedJson}`, 'utf8');\n }\n\n return outPath;\n}\n\nfunction isGeneratedByThisScript(filePath: string): boolean {\n try {\n const contents = readFileSync(filePath, 'utf8');\n const firstLine = contents.split(/\\r?\\n/, 1)[0]?.trim() ?? '';\n\n return firstLine === GENERATED_FILE_HEADER;\n } catch {\n return false;\n }\n}\n\n/**\n * @returns true if the tsconfig path should have a build config generated for it\n */\nfunction shouldUseBuildConfig(tsconfigPath: string, force: boolean): boolean {\n const buildPath = join(dirname(tsconfigPath), 'tsconfig.build.json');\n if (!existsSync(buildPath)) return true;\n if (force) return true;\n return isGeneratedByThisScript(buildPath);\n}\n\nfunction ensureDotRelative(filePath: string): string {\n if (filePath.startsWith('.')) return filePath;\n return `./${filePath}`;\n}\n\n/**\n * Returns the modified tsconfig where the references point to the build configs\n * (that we are going to build)\n */\nfunction replaceRefsWithBuildConfigs(res: TsConfigResult, buildConfigSet: Set<string>, remove: string[]): TsConfigJson {\n const refs = res.config.references;\n if (!refs || refs.length === 0) return res.config;\n\n // console.log('refs', res.path, refs);\n const baseDir = dirname(res.path);\n const mapped: TsConfigJson.References[] = refs\n .map((ref) => {\n const refPath = ensureDotRelative(ref.path);\n const absPath = resolve(dirname(res.path), refPath);\n const resolvedRefPath = resolveTsConfigPath(absPath);\n\n if (remove.includes(resolvedRefPath)) {\n return undefined;\n }\n\n if (!buildConfigSet.has(resolvedRefPath)) {\n // We're not going to build this one so use it plain\n return { ...ref, path: refPath };\n }\n\n const buildRefPath = join(dirname(resolvedRefPath), 'tsconfig.build.json');\n const relativeBuildRef = ensureDotRelative(relative(baseDir, buildRefPath));\n return { ...ref, path: relativeBuildRef };\n })\n .filter((v) => v !== undefined);\n\n return { ...res.config, references: mapped };\n}\n\ntype GenerateOptions = { dryRun: boolean; force: boolean; verbose: boolean; remove: string[] };\n\nasync function generateBuildConfigs(\n entry: string,\n options: GenerateOptions\n): Promise<{ created: { src: string; out: string }[]; visitedConfigs: string[] }> {\n const { dryRun, force, verbose } = options;\n\n const loadedConfigs = new Map<string, TsConfigResult>();\n const visited = new Set<string>();\n const queue: string[] = [entry];\n const created: { src: string; out: string }[] = [];\n\n // First pass: discover the full referenced tsconfig graph and load configs.\n while (queue.length) {\n const tsconfigPath = queue.shift()!;\n if (visited.has(tsconfigPath)) continue;\n visited.add(tsconfigPath);\n\n let res: TsConfigResult;\n\n try {\n const config = parseTsconfig(tsconfigPath);\n if (config) res = { path: tsconfigPath, config };\n else throw new Error('Null returned from getTsConfig');\n } catch (e) {\n logWarn(`Skipping unreadable config: ${formatPath(tsconfigPath)}`);\n if (verbose) console.warn(e);\n continue;\n }\n\n loadedConfigs.set(res.path, res);\n\n const refs = unique(\n (res.config.references ?? []).map((ref) => {\n const abs = resolve(dirname(res.path), ref.path);\n return resolveTsConfigPath(abs);\n })\n );\n for (const r of refs) queue.push(r);\n }\n\n const discoveredConfigs = Array.from(loadedConfigs.keys()).filter((path) => !isGeneratedByThisScript(path));\n const buildConfigSet = new Set(discoveredConfigs.filter((path) => shouldUseBuildConfig(path, force)));\n\n // Second pass: write build configs with rewritten references.\n for (const tsconfigPath of discoveredConfigs) {\n const res = loadedConfigs.get(tsconfigPath)!;\n const buildPath = join(dirname(tsconfigPath), 'tsconfig.build.json');\n\n if (!buildConfigSet.has(tsconfigPath)) {\n if (verbose) {\n logInfo(`Skip ${formatPath(buildPath)} (manual file, use ${colorText('bold', '--force')})`);\n }\n } else {\n const rewrittenCfg = replaceRefsWithBuildConfigs(res, buildConfigSet, options.remove);\n const written = await writeBuildTsconfig(tsconfigPath, rewrittenCfg, dryRun);\n created.push({ src: tsconfigPath, out: written });\n if (verbose || dryRun) {\n const verb = dryRun ? colorText('yellow', '[dry-run] write') : colorText('green', 'write');\n logInfo(`${verb} ${formatPath(written)} <- ${formatPath(tsconfigPath)}`);\n }\n }\n }\n\n if (!verbose && !dryRun) {\n logInfo(`${colorText('green', 'updated')} ${created.length} tsconfig.build.json file(s)`);\n }\n\n return { created, visitedConfigs: Array.from(visited) };\n}\n\nfunction createRegenerator(\n entry: string,\n options: GenerateOptions\n): { run: (reason?: string) => Promise<void>; syncWatchedConfigs: (watcher: FSWatcher) => void } {\n let isRunning = false;\n let rerunRequested = false;\n let watchedConfigs = new Set<string>();\n\n const syncWatchedConfigs = (watcher: FSWatcher): void => {\n if (watchedConfigs.size === 0) return;\n watcher.add(Array.from(watchedConfigs));\n };\n\n const run = async (reason?: string): Promise<void> => {\n if (isRunning) {\n rerunRequested = true;\n return;\n }\n isRunning = true;\n\n try {\n do {\n rerunRequested = false;\n if (reason) {\n logInfo(`${colorText('cyan', 'regenerate')} (${reason})`);\n reason = undefined;\n }\n const result = await generateBuildConfigs(entry, options);\n watchedConfigs = new Set(result.visitedConfigs);\n } while (rerunRequested);\n } finally {\n isRunning = false;\n }\n };\n\n return { run, syncWatchedConfigs };\n}\n\nasync function main(): Promise<void> {\n const { values } = parseArgs({\n args: process.argv.slice(2),\n options: {\n config: { type: 'string', short: 'c' },\n dryRun: { type: 'boolean' },\n force: { type: 'boolean' }, // overwrite files not generated by this script\n watch: { type: 'boolean', short: 'w' },\n verbose: { type: 'boolean', short: 'v' },\n remove: { type: 'string' } // abs paths to tsconfig refs to remove\n }\n });\n\n const entry = values.config ? resolve(values.config) : null;\n if (!entry) {\n logError('Missing required flag: --config <path/to/tsconfig.json>');\n process.exit(1);\n }\n if (!existsSync(entry)) {\n logError(`Config file not found: ${formatPath(entry)}`);\n process.exit(1);\n }\n\n const dryRun = values.dryRun === true;\n const force = values.force === true;\n const watchMode = values.watch === true;\n const verbose = values.verbose === true;\n const remove = (values.remove?.split(' ') ?? []).map((path) =>\n isAbsolute(path) ? path : resolve(process.cwd(), path)\n );\n const options: GenerateOptions = { dryRun, force, verbose, remove };\n\n const regenerator = createRegenerator(entry, options);\n await regenerator.run('initial run');\n\n if (!watchMode) return;\n\n logInfo(`watching ${colorText('cyan', 'tsconfig')} changes...`);\n const watcher = watch([], {\n persistent: true,\n ignoreInitial: true,\n awaitWriteFinish: { stabilityThreshold: 300, pollInterval: 100 }\n });\n regenerator.syncWatchedConfigs(watcher);\n\n watcher.on('change', async (filePath) => {\n logInfo(`${colorText('cyan', 'change')} ${formatPath(filePath)}`);\n await regenerator.run(`changed ${relative(process.cwd(), filePath)}`);\n regenerator.syncWatchedConfigs(watcher);\n });\n\n watcher.on('add', async (filePath) => {\n logInfo(`${colorText('cyan', 'add')} ${formatPath(filePath)}`);\n await regenerator.run(`added ${relative(process.cwd(), filePath)}`);\n regenerator.syncWatchedConfigs(watcher);\n });\n\n watcher.on('unlink', async (filePath) => {\n logInfo(`${colorText('yellow', 'remove')} ${formatPath(filePath)}`);\n await regenerator.run(`removed ${relative(process.cwd(), filePath)}`);\n regenerator.syncWatchedConfigs(watcher);\n });\n}\n\nmain().catch((err) => {\n logError('Unhandled error');\n console.error(err);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;AAgBA,MAAM,wBAAwB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACD;AACD,MAAM,wBAAwB;AAE9B,MAAM,QAAQ,UAAU,QAAQ,oBAAoB;AACpD,MAAM,cAAc,aAA6B,UAAU,OAAO,SAAS,QAAQ,KAAK,EAAE,SAAS,CAAC;AACpG,MAAM,WAAW,YAA0B,QAAQ,IAAI,GAAG,MAAM,GAAG,UAAU;AAC7E,MAAM,WAAW,YAA0B,QAAQ,KAAK,GAAG,MAAM,GAAG,UAAU,UAAU,QAAQ,GAAG;AACnG,MAAM,YAAY,YAA0B,QAAQ,MAAM,GAAG,MAAM,GAAG,UAAU,OAAO,QAAQ,GAAG;AAElG,SAAS,OAAO,OAA2B;AACzC,QAAO,MAAM,KAAK,IAAI,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,GAAG;AACrE,cAAY,mBAAmB,QAAQ;GACvC;AAEF,SAAQ,GAAG,OAAO,OAAO,aAAa;AACpC,UAAQ,GAAG,UAAU,QAAQ,MAAM,CAAC,GAAG,WAAW,SAAS,GAAG;AAC9D,QAAM,YAAY,IAAI,SAAS,SAAS,QAAQ,KAAK,EAAE,SAAS,GAAG;AACnE,cAAY,mBAAmB,QAAQ;GACvC;AAEF,SAAQ,GAAG,UAAU,OAAO,aAAa;AACvC,UAAQ,GAAG,UAAU,UAAU,SAAS,CAAC,GAAG,WAAW,SAAS,GAAG;AACnE,QAAM,YAAY,IAAI,WAAW,SAAS,QAAQ,KAAK,EAAE,SAAS,GAAG;AACrE,cAAY,mBAAmB,QAAQ;GACvC;;AAGJ,MAAM,CAAC,OAAO,QAAQ;AACpB,UAAS,kBAAkB;AAC3B,SAAQ,MAAM,IAAI;AAClB,SAAQ,KAAK,EAAE;EACf"}
|
|
1
|
+
{"version":3,"file":"ts-build-config.mjs","names":["formatWithOxfmt"],"sources":["../../src/scripts/ts-build-config.ts"],"sourcesContent":["#!/usr/bin/env bun\n\nimport console from 'console';\nimport { mkdirSync, writeFileSync, existsSync, readFileSync } from 'fs';\nimport { dirname, join, resolve, relative, isAbsolute } from 'path';\nimport { fileURLToPath } from 'url';\nimport { parseArgs } from 'util';\n\nimport type { FSWatcher } from 'chokidar';\nimport { watch } from 'chokidar';\nimport { type TsConfigResult, type TsConfigJson, parseTsconfig } from 'get-tsconfig';\nimport { format as formatWithOxfmt } from 'oxfmt';\n\nimport { colorText } from '../utils/cli.js';\n\n// TODO on startup check cwd for oxfmt config and use that instead of my default\n\nconst DEFAULT_TEST_EXCLUDES = [\n '**/*.test.ts',\n '**/*.test.tsx',\n '**/*.spec.ts',\n '**/*.spec.tsx',\n '**/__tests__/**',\n '**/tests/**'\n];\nexport const GENERATED_FILE_HEADER = '// generated by ts-build-config';\n\nconst LABEL = colorText('cyan', '[ts-build-config]');\nconst formatPath = (filePath: string): string => colorText('dim', relative(process.cwd(), filePath));\nconst logInfo = (message: string): void => console.log(`${LABEL} ${message}`);\nconst logWarn = (message: string): void => console.warn(`${LABEL} ${colorText('yellow', message)}`);\nconst logError = (message: string): void => console.error(`${LABEL} ${colorText('red', message)}`);\n\nexport function unique(items: string[]): string[] {\n return Array.from(new Set(items));\n}\n\n/**\n * If the path refers to a file then it returns it otherwise joins tsconfig.json\n */\nexport function resolveTsConfigPath(refAbsPath: string): string {\n if (refAbsPath.endsWith('.json')) return refAbsPath;\n else return join(refAbsPath, 'tsconfig.json');\n}\n\n/**\n * Excludes extra paths from the include list that contain test patterns\n */\nexport function computeExtraExcludes(config: TsConfigJson): string[] {\n const extra: string[] = [...DEFAULT_TEST_EXCLUDES];\n\n // If the tsconfig includes ./tests (or tests) explicitly, ensure it is excluded in build config.\n for (const inc of config.include ?? []) {\n const norm = inc.replace(/\\\\/g, '/').replace(/\\/+$/, '');\n if (norm === './tests' || norm === 'tests' || norm.startsWith('./tests/') || norm.startsWith('tests/')) {\n extra.push('./tests/**');\n break;\n }\n }\n\n return unique(extra);\n}\n\nexport function withTrailingNewline(value: string): string {\n return value.endsWith('\\n') ? value : `${value}\\n`;\n}\n\nexport async function formatBuildTsconfigJson(config: TsConfigJson): Promise<string> {\n const fallback = JSON.stringify(config, null, 2);\n\n try {\n const result = await formatWithOxfmt('tsconfig.build.json', fallback, {\n useTabs: false,\n singleQuote: true,\n trailingComma: 'none',\n printWidth: 120,\n objectWrap: 'collapse',\n semi: true,\n proseWrap: 'always',\n sortPackageJson: { sortScripts: true },\n sortImports: {}\n });\n if (!result.errors.length && typeof result.code === 'string' && result.code.length > 0) {\n return withTrailingNewline(result.code);\n }\n } catch {\n // Fallback to plain JSON below.\n }\n\n return withTrailingNewline(fallback);\n}\n\nexport async function writeBuildTsconfig(tsconfigPath: string, config: TsConfigJson, dryRun: boolean): Promise<string> {\n const dir = dirname(tsconfigPath);\n const outPath = join(dir, 'tsconfig.build.json');\n\n const mergedExclude = unique([...(config.exclude ?? []), ...computeExtraExcludes(config)]);\n\n const buildConfig: TsConfigJson = { extends: './tsconfig.json', compilerOptions: {}, exclude: mergedExclude };\n\n if (config.references && config.references.length > 0) buildConfig.references = config.references;\n\n // If original compilerOptions exists, keep build-specific overrides minimal.\n // But ensure emit is enabled if base tsconfig has noEmit: true (common for editor configs).\n if (config.compilerOptions?.noEmit === true) buildConfig.compilerOptions!.noEmit = false;\n\n // Keep outDir/rootDir if already set in base; do not guess.\n // If you want to force them, do it in the base tsconfig.json or pass flags later.\n\n if (!dryRun) {\n mkdirSync(dir, { recursive: true });\n const formattedJson = await formatBuildTsconfigJson(buildConfig);\n writeFileSync(outPath, `${GENERATED_FILE_HEADER}\\n${formattedJson}`, 'utf8');\n }\n\n return outPath;\n}\n\nexport function isGeneratedByThisScript(filePath: string): boolean {\n try {\n const contents = readFileSync(filePath, 'utf8');\n const firstLine = contents.split(/\\r?\\n/, 1)[0]?.trim() ?? '';\n\n return firstLine === GENERATED_FILE_HEADER;\n } catch {\n return false;\n }\n}\n\n/**\n * @returns true if the tsconfig path should have a build config generated for it\n */\nexport function shouldUseBuildConfig(tsconfigPath: string, force: boolean): boolean {\n const buildPath = join(dirname(tsconfigPath), 'tsconfig.build.json');\n if (!existsSync(buildPath)) return true;\n if (force) return true;\n return isGeneratedByThisScript(buildPath);\n}\n\nexport function ensureDotRelative(filePath: string): string {\n if (filePath.startsWith('.')) return filePath;\n return `./${filePath}`;\n}\n\n/**\n * Returns the modified tsconfig where the references point to the build configs\n * (that we are going to build)\n */\nexport function replaceRefsWithBuildConfigs(\n res: TsConfigResult,\n buildConfigSet: Set<string>,\n remove: string[]\n): TsConfigJson {\n const refs = res.config.references;\n if (!refs || refs.length === 0) return res.config;\n\n // console.log('refs', res.path, refs);\n const baseDir = dirname(res.path);\n const mapped: TsConfigJson.References[] = refs\n .map((ref) => {\n const refPath = ensureDotRelative(ref.path);\n const absPath = resolve(dirname(res.path), refPath);\n const resolvedRefPath = resolveTsConfigPath(absPath);\n\n if (remove.includes(resolvedRefPath)) {\n return undefined;\n }\n\n if (!buildConfigSet.has(resolvedRefPath)) {\n // We're not going to build this one so use it plain\n return { ...ref, path: refPath };\n }\n\n const buildRefPath = join(dirname(resolvedRefPath), 'tsconfig.build.json');\n const relativeBuildRef = ensureDotRelative(relative(baseDir, buildRefPath));\n return { ...ref, path: relativeBuildRef };\n })\n .filter((v) => v !== undefined);\n\n return { ...res.config, references: mapped };\n}\n\nexport type GenerateOptions = { dryRun: boolean; force: boolean; verbose: boolean; remove: string[] };\n\nexport async function generateBuildConfigs(\n entry: string,\n options: GenerateOptions\n): Promise<{ created: { src: string; out: string }[]; visitedConfigs: string[] }> {\n const { dryRun, force, verbose } = options;\n\n const loadedConfigs = new Map<string, TsConfigResult>();\n const visited = new Set<string>();\n const queue: string[] = [entry];\n const created: { src: string; out: string }[] = [];\n\n // First pass: discover the full referenced tsconfig graph and load configs.\n while (queue.length) {\n const tsconfigPath = queue.shift()!;\n if (visited.has(tsconfigPath)) continue;\n visited.add(tsconfigPath);\n\n let res: TsConfigResult;\n\n try {\n const config = parseTsconfig(tsconfigPath);\n if (config) res = { path: tsconfigPath, config };\n else throw new Error('Null returned from getTsConfig');\n } catch (e) {\n logWarn(`Skipping unreadable config: ${formatPath(tsconfigPath)}`);\n if (verbose) console.warn(e);\n continue;\n }\n\n loadedConfigs.set(res.path, res);\n\n const refs = unique(\n (res.config.references ?? []).map((ref) => {\n const abs = resolve(dirname(res.path), ref.path);\n return resolveTsConfigPath(abs);\n })\n );\n for (const r of refs) queue.push(r);\n }\n\n const discoveredConfigs = Array.from(loadedConfigs.keys()).filter((path) => !isGeneratedByThisScript(path));\n const buildConfigSet = new Set(discoveredConfigs.filter((path) => shouldUseBuildConfig(path, force)));\n\n // Second pass: write build configs with rewritten references.\n for (const tsconfigPath of discoveredConfigs) {\n const res = loadedConfigs.get(tsconfigPath)!;\n const buildPath = join(dirname(tsconfigPath), 'tsconfig.build.json');\n\n if (!buildConfigSet.has(tsconfigPath)) {\n if (verbose) {\n logInfo(`Skip ${formatPath(buildPath)} (manual file, use ${colorText('bold', '--force')})`);\n }\n } else {\n const rewrittenCfg = replaceRefsWithBuildConfigs(res, buildConfigSet, options.remove);\n const written = await writeBuildTsconfig(tsconfigPath, rewrittenCfg, dryRun);\n created.push({ src: tsconfigPath, out: written });\n if (verbose || dryRun) {\n const verb = dryRun ? colorText('yellow', '[dry-run] write') : colorText('green', 'write');\n logInfo(`${verb} ${formatPath(written)} <- ${formatPath(tsconfigPath)}`);\n }\n }\n }\n\n if (!verbose && !dryRun) {\n logInfo(`${colorText('green', 'updated')} ${created.length} tsconfig.build.json file(s)`);\n }\n\n return { created, visitedConfigs: Array.from(visited) };\n}\n\nexport function createRegenerator(\n entry: string,\n options: GenerateOptions\n): { run: (reason?: string) => Promise<void>; syncWatchedConfigs: (watcher: FSWatcher) => void } {\n let isRunning = false;\n let rerunRequested = false;\n let watchedConfigs = new Set<string>();\n\n const syncWatchedConfigs = (watcher: FSWatcher): void => {\n if (watchedConfigs.size === 0) return;\n watcher.add(Array.from(watchedConfigs));\n };\n\n const run = async (reason?: string): Promise<void> => {\n if (isRunning) {\n rerunRequested = true;\n return;\n }\n isRunning = true;\n\n try {\n do {\n rerunRequested = false;\n if (reason) {\n logInfo(`${colorText('cyan', 'regenerate')} (${reason})`);\n reason = undefined;\n }\n const result = await generateBuildConfigs(entry, options);\n watchedConfigs = new Set(result.visitedConfigs);\n } while (rerunRequested);\n } finally {\n isRunning = false;\n }\n };\n\n return { run, syncWatchedConfigs };\n}\n\nexport async function main(): Promise<void> {\n const { values } = parseArgs({\n args: process.argv.slice(2),\n options: {\n config: { type: 'string', short: 'c' },\n dryRun: { type: 'boolean' },\n force: { type: 'boolean' }, // overwrite files not generated by this script\n watch: { type: 'boolean', short: 'w' },\n verbose: { type: 'boolean', short: 'v' },\n remove: { type: 'string' } // abs paths to tsconfig refs to remove\n }\n });\n\n const entry = values.config ? resolve(values.config) : null;\n if (!entry) {\n logError('Missing required flag: --config <path/to/tsconfig.json>');\n process.exit(1);\n }\n if (!existsSync(entry)) {\n logError(`Config file not found: ${formatPath(entry)}`);\n process.exit(1);\n }\n\n const dryRun = values.dryRun === true;\n const force = values.force === true;\n const watchMode = values.watch === true;\n const verbose = values.verbose === true;\n const remove = (values.remove?.split(' ') ?? []).map((path) =>\n isAbsolute(path) ? path : resolve(process.cwd(), path)\n );\n const options: GenerateOptions = { dryRun, force, verbose, remove };\n\n const regenerator = createRegenerator(entry, options);\n await regenerator.run('initial run');\n\n if (!watchMode) return;\n\n logInfo(`watching ${colorText('cyan', 'tsconfig')} changes...`);\n const watcher = watch([], {\n persistent: true,\n ignoreInitial: true,\n awaitWriteFinish: { stabilityThreshold: 300, pollInterval: 100 }\n });\n regenerator.syncWatchedConfigs(watcher);\n\n watcher.on('change', async (filePath) => {\n logInfo(`${colorText('cyan', 'change')} ${formatPath(filePath)}`);\n await regenerator.run(`changed ${relative(process.cwd(), filePath)}`);\n regenerator.syncWatchedConfigs(watcher);\n });\n\n watcher.on('add', async (filePath) => {\n logInfo(`${colorText('cyan', 'add')} ${formatPath(filePath)}`);\n await regenerator.run(`added ${relative(process.cwd(), filePath)}`);\n regenerator.syncWatchedConfigs(watcher);\n });\n\n watcher.on('unlink', async (filePath) => {\n logInfo(`${colorText('yellow', 'remove')} ${formatPath(filePath)}`);\n await regenerator.run(`removed ${relative(process.cwd(), filePath)}`);\n regenerator.syncWatchedConfigs(watcher);\n });\n}\n\nfunction isDirectExecution(): boolean {\n if (!process.argv[1]) return false;\n return resolve(process.argv[1]) === fileURLToPath(import.meta.url);\n}\n\nif (isDirectExecution()) {\n main().catch((err) => {\n logError('Unhandled error');\n console.error(err);\n process.exit(1);\n });\n}\n"],"mappings":";;;;;;;;;;;AAiBA,MAAM,wBAAwB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACD;AACD,MAAa,wBAAwB;AAErC,MAAM,QAAQ,UAAU,QAAQ,oBAAoB;AACpD,MAAM,cAAc,aAA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
"bugs": "https://github.com/ageorgeh/ts-ag/issues",
|
|
6
6
|
"author": "Alexander Hornung",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"watch": "tsdown --watch"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@aws-sdk/client-cognito-identity-provider": "3.
|
|
45
|
-
"@aws-sdk/client-s3": "3.
|
|
46
|
-
"@aws-sdk/s3-request-presigner": "3.
|
|
44
|
+
"@aws-sdk/client-cognito-identity-provider": "3.1022.0",
|
|
45
|
+
"@aws-sdk/client-s3": "3.1022.0",
|
|
46
|
+
"@aws-sdk/s3-request-presigner": "3.1022.0",
|
|
47
47
|
"@ungap/structured-clone": "1.3.0",
|
|
48
48
|
"chalk": "5.6.2",
|
|
49
49
|
"chokidar": "5.0.0",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"glob": "^13.0.6",
|
|
56
56
|
"jose": "6.2.2",
|
|
57
57
|
"neverthrow": "8.2.0",
|
|
58
|
-
"oxfmt": "^0.
|
|
58
|
+
"oxfmt": "^0.43.0",
|
|
59
59
|
"radash": "^12.1.1",
|
|
60
60
|
"rehype-parse": "9.0.1",
|
|
61
61
|
"tsc-alias": "1.8.16",
|
|
@@ -65,22 +65,21 @@
|
|
|
65
65
|
"vfile": "6.0.3"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@actions/languageserver": "^0.3.
|
|
68
|
+
"@actions/languageserver": "^0.3.50",
|
|
69
69
|
"@types/aws-lambda": "8.10.161",
|
|
70
70
|
"@types/hast": "3.0.4",
|
|
71
71
|
"@types/node": "^24.12.0",
|
|
72
72
|
"@types/ungap__structured-clone": "1.2.0",
|
|
73
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
73
|
+
"@typescript/native-preview": "7.0.0-dev.20260401.1",
|
|
74
74
|
"concurrently": "^9.2.1",
|
|
75
75
|
"globals": "^17.4.0",
|
|
76
76
|
"husky": "^9.1.7",
|
|
77
77
|
"jiti": "2.6.1",
|
|
78
78
|
"lint-staged": "^16.4.0",
|
|
79
|
-
"oxlint": "^1.
|
|
79
|
+
"oxlint": "^1.58.0",
|
|
80
80
|
"semantic-release": "^25.0.3",
|
|
81
|
-
"tsdown": "^0.21.
|
|
81
|
+
"tsdown": "^0.21.7",
|
|
82
82
|
"typescript": "^6.0.2",
|
|
83
|
-
"typescript-svelte-plugin": "0.3.50",
|
|
84
83
|
"vitest": "^4.1.2"
|
|
85
84
|
},
|
|
86
85
|
"peerDependencies": {
|