@powerlines/engine 0.47.4 → 0.49.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/build.cjs +66 -0
- package/dist/api/build.d.cts +14 -0
- package/dist/api/build.d.cts.map +1 -0
- package/dist/api/build.d.mts +14 -0
- package/dist/api/build.d.mts.map +1 -0
- package/dist/api/build.mjs +64 -0
- package/dist/api/build.mjs.map +1 -0
- package/dist/api/clean.cjs +28 -0
- package/dist/api/clean.d.cts +14 -0
- package/dist/api/clean.d.cts.map +1 -0
- package/dist/api/clean.d.mts +14 -0
- package/dist/api/clean.d.mts.map +1 -0
- package/dist/api/clean.mjs +28 -0
- package/dist/api/clean.mjs.map +1 -0
- package/dist/api/create.cjs +59 -0
- package/dist/api/create.d.cts +14 -0
- package/dist/api/create.d.cts.map +1 -0
- package/dist/api/create.d.mts +14 -0
- package/dist/api/create.d.mts.map +1 -0
- package/dist/api/create.mjs +57 -0
- package/dist/api/create.mjs.map +1 -0
- package/dist/api/deploy.cjs +24 -0
- package/dist/api/deploy.d.cts +17 -0
- package/dist/api/deploy.d.cts.map +1 -0
- package/dist/api/deploy.d.mts +17 -0
- package/dist/api/deploy.d.mts.map +1 -0
- package/dist/api/deploy.mjs +24 -0
- package/dist/api/deploy.mjs.map +1 -0
- package/dist/api/docs.cjs +24 -0
- package/dist/api/docs.d.cts +17 -0
- package/dist/api/docs.d.cts.map +1 -0
- package/dist/api/docs.d.mts +17 -0
- package/dist/api/docs.d.mts.map +1 -0
- package/dist/api/docs.mjs +24 -0
- package/dist/api/docs.mjs.map +1 -0
- package/dist/api/lint.cjs +27 -0
- package/dist/api/lint.d.cts +17 -0
- package/dist/api/lint.d.cts.map +1 -0
- package/dist/api/lint.d.mts +17 -0
- package/dist/api/lint.d.mts.map +1 -0
- package/dist/api/lint.mjs +27 -0
- package/dist/api/lint.mjs.map +1 -0
- package/dist/api/prepare.cjs +68 -0
- package/dist/api/prepare.d.cts +14 -0
- package/dist/api/prepare.d.cts.map +1 -0
- package/dist/api/prepare.d.mts +14 -0
- package/dist/api/prepare.d.mts.map +1 -0
- package/dist/api/prepare.mjs +68 -0
- package/dist/api/prepare.mjs.map +1 -0
- package/dist/api/test.cjs +27 -0
- package/dist/api/test.d.cts +17 -0
- package/dist/api/test.d.cts.map +1 -0
- package/dist/api/test.d.mts +17 -0
- package/dist/api/test.d.mts.map +1 -0
- package/dist/api/test.mjs +27 -0
- package/dist/api/test.mjs.map +1 -0
- package/dist/api/types.cjs +70 -0
- package/dist/api/types.d.cts +17 -0
- package/dist/api/types.d.cts.map +1 -0
- package/dist/api/types.d.mts +17 -0
- package/dist/api/types.d.mts.map +1 -0
- package/dist/api/types.mjs +70 -0
- package/dist/api/types.mjs.map +1 -0
- package/dist/api-BgyEi2hF.d.mts +138 -0
- package/dist/api-BgyEi2hF.d.mts.map +1 -0
- package/dist/api-DcHfCjQK.d.cts +138 -0
- package/dist/api-DcHfCjQK.d.cts.map +1 -0
- package/dist/api.cjs +39 -1268
- package/dist/api.d.cts +11 -300
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.mts +11 -300
- package/dist/api.d.mts.map +1 -1
- package/dist/api.mjs +31 -1264
- package/dist/api.mjs.map +1 -1
- package/dist/config-ByLyzMI0.d.mts +204 -0
- package/dist/config-ByLyzMI0.d.mts.map +1 -0
- package/dist/config-DKEmqMrh.d.cts +204 -0
- package/dist/config-DKEmqMrh.d.cts.map +1 -0
- package/dist/context/engine-context.cjs +177 -0
- package/dist/context/engine-context.d.cts +2 -0
- package/dist/context/engine-context.d.mts +2 -0
- package/dist/context/engine-context.mjs +175 -0
- package/dist/context/engine-context.mjs.map +1 -0
- package/dist/context/index.cjs +2 -9
- package/dist/context/index.d.cts +2 -150
- package/dist/context/index.d.mts +2 -150
- package/dist/context/index.mjs +2 -4
- package/dist/context-D0_a0kRO.d.cts +149 -0
- package/dist/context-D0_a0kRO.d.cts.map +1 -0
- package/dist/context-DcXV6_GL.d.mts +149 -0
- package/dist/context-DcXV6_GL.d.mts.map +1 -0
- package/dist/engine-Dz6BvkFY.cjs +590 -0
- package/dist/engine-context-B8K6Jtkk.d.cts +53 -0
- package/dist/engine-context-B8K6Jtkk.d.cts.map +1 -0
- package/dist/engine-context-DKlA5Pgu.d.mts +53 -0
- package/dist/engine-context-DKlA5Pgu.d.mts.map +1 -0
- package/dist/engine-q6YKXXcB.mjs +571 -0
- package/dist/engine-q6YKXXcB.mjs.map +1 -0
- package/dist/engine.cjs +6 -0
- package/dist/engine.d.cts +143 -0
- package/dist/engine.d.cts.map +1 -0
- package/dist/engine.d.mts +143 -0
- package/dist/engine.d.mts.map +1 -0
- package/dist/engine.mjs +3 -0
- package/dist/helpers/create-execution-host.cjs +57 -0
- package/dist/helpers/create-execution-host.d.cts +20 -0
- package/dist/helpers/create-execution-host.d.cts.map +1 -0
- package/dist/helpers/create-execution-host.d.mts +20 -0
- package/dist/helpers/create-execution-host.d.mts.map +1 -0
- package/dist/helpers/create-execution-host.mjs +57 -0
- package/dist/helpers/create-execution-host.mjs.map +1 -0
- package/dist/helpers/finalize.cjs +26 -0
- package/dist/helpers/finalize.d.cts +12 -0
- package/dist/helpers/finalize.d.cts.map +1 -0
- package/dist/helpers/finalize.d.mts +12 -0
- package/dist/helpers/finalize.d.mts.map +1 -0
- package/dist/helpers/finalize.mjs +26 -0
- package/dist/helpers/finalize.mjs.map +1 -0
- package/dist/helpers/index.cjs +12 -0
- package/dist/helpers/index.d.cts +5 -0
- package/dist/helpers/index.d.mts +5 -0
- package/dist/helpers/index.mjs +6 -0
- package/dist/helpers/rpc.cjs +139 -0
- package/dist/helpers/rpc.d.cts +7 -0
- package/dist/helpers/rpc.d.cts.map +1 -0
- package/dist/helpers/rpc.d.mts +7 -0
- package/dist/helpers/rpc.d.mts.map +1 -0
- package/dist/helpers/rpc.mjs +139 -0
- package/dist/helpers/rpc.mjs.map +1 -0
- package/dist/helpers/stream.cjs +119 -0
- package/dist/helpers/stream.d.cts +45 -0
- package/dist/helpers/stream.d.cts.map +1 -0
- package/dist/helpers/stream.d.mts +45 -0
- package/dist/helpers/stream.d.mts.map +1 -0
- package/dist/helpers/stream.mjs +117 -0
- package/dist/helpers/stream.mjs.map +1 -0
- package/dist/index-BVVgDSdq.d.cts +1 -0
- package/dist/index-BVVgDSdq.d.mts +1 -0
- package/dist/index.cjs +8 -748
- package/dist/index.d.cts +6 -140
- package/dist/index.d.mts +6 -140
- package/dist/index.mjs +4 -747
- package/package.json +102 -132
- package/dist/_internal/worker.cjs +0 -5192
- package/dist/_internal/worker.d.cts +0 -46
- package/dist/_internal/worker.d.cts.map +0 -1
- package/dist/_internal/worker.d.mts +0 -46
- package/dist/_internal/worker.d.mts.map +0 -1
- package/dist/_internal/worker.mjs +0 -5153
- package/dist/_internal/worker.mjs.map +0 -1
- package/dist/base-context-DLemGRbd.cjs +0 -322
- package/dist/base-context-DUha4Lz-.mjs +0 -315
- package/dist/base-context-DUha4Lz-.mjs.map +0 -1
- package/dist/context/index.d.cts.map +0 -1
- package/dist/context/index.d.mts.map +0 -1
- package/dist/engine-context-BfFiKN53.mjs +0 -86
- package/dist/engine-context-BfFiKN53.mjs.map +0 -1
- package/dist/engine-context-D0y88i_J.cjs +0 -91
- package/dist/execution-context-CE5H90Um.mjs +0 -2845
- package/dist/execution-context-CE5H90Um.mjs.map +0 -1
- package/dist/execution-context-CnyaM3Ul.cjs +0 -2889
- package/dist/execution-context-NyDjVZ6T.d.cts +0 -647
- package/dist/execution-context-NyDjVZ6T.d.cts.map +0 -1
- package/dist/execution-context-YrjFeD9k.d.mts +0 -647
- package/dist/execution-context-YrjFeD9k.d.mts.map +0 -1
- package/dist/fs-CeEdzPKE.cjs +0 -262
- package/dist/fs-Dcle8lUp.mjs +0 -226
- package/dist/fs-Dcle8lUp.mjs.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/rpc/client.cjs +0 -74
- package/dist/rpc/client.d.cts +0 -31
- package/dist/rpc/client.d.cts.map +0 -1
- package/dist/rpc/client.d.mts +0 -31
- package/dist/rpc/client.d.mts.map +0 -1
- package/dist/rpc/client.mjs +0 -71
- package/dist/rpc/client.mjs.map +0 -1
- package/dist/rpc/serialization.cjs +0 -82
- package/dist/rpc/serialization.d.cts +0 -46
- package/dist/rpc/serialization.d.cts.map +0 -1
- package/dist/rpc/serialization.d.mts +0 -46
- package/dist/rpc/serialization.d.mts.map +0 -1
- package/dist/rpc/serialization.mjs +0 -76
- package/dist/rpc/serialization.mjs.map +0 -1
- package/dist/rpc/server.cjs +0 -69
- package/dist/rpc/server.d.cts +0 -29
- package/dist/rpc/server.d.cts.map +0 -1
- package/dist/rpc/server.d.mts +0 -29
- package/dist/rpc/server.d.mts.map +0 -1
- package/dist/rpc/server.mjs +0 -66
- package/dist/rpc/server.mjs.map +0 -1
- package/dist/rpc/types.cjs +0 -0
- package/dist/rpc/types.d.cts +0 -70
- package/dist/rpc/types.d.cts.map +0 -1
- package/dist/rpc/types.d.mts +0 -70
- package/dist/rpc/types.d.mts.map +0 -1
- package/dist/rpc/types.mjs +0 -1
- package/dist/schemas.cjs +0 -9
- package/dist/schemas.d.cts +0 -127
- package/dist/schemas.d.cts.map +0 -1
- package/dist/schemas.d.mts +0 -127
- package/dist/schemas.d.mts.map +0 -1
- package/dist/schemas.mjs +0 -3
- package/dist/storage/base.cjs +0 -216
- package/dist/storage/base.d.cts +0 -199
- package/dist/storage/base.d.cts.map +0 -1
- package/dist/storage/base.d.mts +0 -199
- package/dist/storage/base.d.mts.map +0 -1
- package/dist/storage/base.mjs +0 -215
- package/dist/storage/base.mjs.map +0 -1
- package/dist/storage/file-system.cjs +0 -180
- package/dist/storage/file-system.d.cts +0 -127
- package/dist/storage/file-system.d.cts.map +0 -1
- package/dist/storage/file-system.d.mts +0 -127
- package/dist/storage/file-system.d.mts.map +0 -1
- package/dist/storage/file-system.mjs +0 -179
- package/dist/storage/file-system.mjs.map +0 -1
- package/dist/storage/helpers.cjs +0 -37
- package/dist/storage/helpers.d.cts +0 -25
- package/dist/storage/helpers.d.cts.map +0 -1
- package/dist/storage/helpers.d.mts +0 -25
- package/dist/storage/helpers.d.mts.map +0 -1
- package/dist/storage/helpers.mjs +0 -34
- package/dist/storage/helpers.mjs.map +0 -1
- package/dist/storage/index.cjs +0 -12
- package/dist/storage/index.d.cts +0 -5
- package/dist/storage/index.d.mts +0 -5
- package/dist/storage/index.mjs +0 -6
- package/dist/storage/virtual.cjs +0 -98
- package/dist/storage/virtual.d.cts +0 -80
- package/dist/storage/virtual.d.cts.map +0 -1
- package/dist/storage/virtual.d.mts +0 -80
- package/dist/storage/virtual.d.mts.map +0 -1
- package/dist/storage/virtual.mjs +0 -97
- package/dist/storage/virtual.mjs.map +0 -1
- package/dist/ts-morph-BbM83PT9.cjs +0 -114
- package/dist/ts-morph-C6YBNc46.mjs +0 -102
- package/dist/ts-morph-C6YBNc46.mjs.map +0 -1
- package/dist/tsconfig-DeKMGasE.cjs +0 -198
- package/dist/tsconfig-HzJsMUrr.mjs +0 -155
- package/dist/tsconfig-HzJsMUrr.mjs.map +0 -1
- package/dist/typescript/index.cjs +0 -13
- package/dist/typescript/index.d.cts +0 -106
- package/dist/typescript/index.d.cts.map +0 -1
- package/dist/typescript/index.d.mts +0 -106
- package/dist/typescript/index.d.mts.map +0 -1
- package/dist/typescript/index.mjs +0 -4
- /package/dist/{chunk-C0xms8kb.cjs → chunk-C_NdSu1c.cjs} +0 -0
package/dist/storage/virtual.mjs
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { BaseStorageAdapter } from "./base.mjs";
|
|
2
|
-
import { isParentPath } from "@stryke/path/is-parent-path";
|
|
3
|
-
|
|
4
|
-
//#region src/storage/virtual.ts
|
|
5
|
-
/**
|
|
6
|
-
* Virtual/in-memory storage adapter implementation.
|
|
7
|
-
*/
|
|
8
|
-
var VirtualStorageAdapter = class extends BaseStorageAdapter {
|
|
9
|
-
/**
|
|
10
|
-
* A name identifying the storage adapter type.
|
|
11
|
-
*/
|
|
12
|
-
name = "virtual";
|
|
13
|
-
/**
|
|
14
|
-
* The storage preset for the adapter.
|
|
15
|
-
*
|
|
16
|
-
* @remarks
|
|
17
|
-
* This can be used as an alternate way to identify the type of storage being used.
|
|
18
|
-
*/
|
|
19
|
-
preset = "virtual";
|
|
20
|
-
/**
|
|
21
|
-
* In-memory data storage.
|
|
22
|
-
*/
|
|
23
|
-
data = /* @__PURE__ */ new Map();
|
|
24
|
-
/**
|
|
25
|
-
* Constructor for the VirtualStorageAdapter.
|
|
26
|
-
*
|
|
27
|
-
* @param context - The Powerlines context.
|
|
28
|
-
* @param options - Configuration options for the storage adapter.
|
|
29
|
-
*/
|
|
30
|
-
constructor(context, options) {
|
|
31
|
-
super(context, options);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Synchronously checks if a key exists in the storage.
|
|
35
|
-
*
|
|
36
|
-
* @param key - The key to check for existence.
|
|
37
|
-
* @returns Returns `true` if the key exists, otherwise `false`.
|
|
38
|
-
*/
|
|
39
|
-
existsSync(key) {
|
|
40
|
-
return this.data.has(this.resolve(key));
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Synchronously retrieves the value associated with a given key.
|
|
44
|
-
*
|
|
45
|
-
* @param key - The key whose value is to be retrieved.
|
|
46
|
-
* @returns The value associated with the key, or `null` if the key does not exist.
|
|
47
|
-
*/
|
|
48
|
-
getSync(key) {
|
|
49
|
-
return this.data.get(this.resolve(key)) ?? null;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Synchronously sets the value for a given key.
|
|
53
|
-
*
|
|
54
|
-
* @param key - The key to set the value for.
|
|
55
|
-
* @param value - The value to set.
|
|
56
|
-
*/
|
|
57
|
-
setSync(key, value) {
|
|
58
|
-
if (!this.isReadOnly && (!this.existsSync(key) || this.overwrite)) this.data.set(this.resolve(key), value);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Synchronously removes a key from the storage.
|
|
62
|
-
*
|
|
63
|
-
* @param key - The key to remove.
|
|
64
|
-
*/
|
|
65
|
-
removeSync(key) {
|
|
66
|
-
if (!this.isReadOnly && this.overwrite) this.data.delete(this.resolve(key));
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Lists all keys under a given base path synchronously.
|
|
70
|
-
*
|
|
71
|
-
* @param base - The base path to list keys from.
|
|
72
|
-
* @returns An array of keys under the specified base path.
|
|
73
|
-
*/
|
|
74
|
-
listSync(base) {
|
|
75
|
-
return [...this.data.keys().filter((key) => !base ? true : isParentPath(key, this.resolve(base)))];
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Disposes of the storage adapter, releasing any held resources.
|
|
79
|
-
*
|
|
80
|
-
* @returns A promise that resolves when the disposal is complete.
|
|
81
|
-
*/
|
|
82
|
-
async dispose() {
|
|
83
|
-
return this.clear();
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Determines if the storage adapter should overwrite existing keys based on the provided options and context configuration.
|
|
87
|
-
*
|
|
88
|
-
* @returns `true` if the storage adapter should overwrite existing keys, otherwise `false`.
|
|
89
|
-
*/
|
|
90
|
-
get overwrite() {
|
|
91
|
-
return !this.isReadOnly;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
//#endregion
|
|
96
|
-
export { VirtualStorageAdapter };
|
|
97
|
-
//# sourceMappingURL=virtual.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"virtual.mjs","names":[],"sources":["../../src/storage/virtual.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Context } from \"@powerlines/core\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { BaseStorageAdapter, StorageAdapterOptions } from \"./base\";\n\n/**\n * Virtual/in-memory storage adapter implementation.\n */\nexport class VirtualStorageAdapter extends BaseStorageAdapter {\n /**\n * A name identifying the storage adapter type.\n */\n public name = \"virtual\";\n\n /**\n * The storage preset for the adapter.\n *\n * @remarks\n * This can be used as an alternate way to identify the type of storage being used.\n */\n public override readonly preset = \"virtual\";\n\n /**\n * In-memory data storage.\n */\n protected data = new Map<string, any>();\n\n /**\n * Constructor for the VirtualStorageAdapter.\n *\n * @param context - The Powerlines context.\n * @param options - Configuration options for the storage adapter.\n */\n public constructor(context: Context, options?: StorageAdapterOptions) {\n super(context, options);\n }\n\n /**\n * Synchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns Returns `true` if the key exists, otherwise `false`.\n */\n public existsSync(key: string): boolean {\n return this.data.has(this.resolve(key));\n }\n\n /**\n * Synchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns The value associated with the key, or `null` if the key does not exist.\n */\n public getSync(key: string): string | null {\n return this.data.get(this.resolve(key)) ?? null;\n }\n\n /**\n * Synchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public setSync(key: string, value: string) {\n if (!this.isReadOnly && (!this.existsSync(key) || this.overwrite)) {\n this.data.set(this.resolve(key), value);\n }\n }\n\n /**\n * Synchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public removeSync(key: string) {\n if (!this.isReadOnly && this.overwrite) {\n this.data.delete(this.resolve(key));\n }\n }\n\n /**\n * Lists all keys under a given base path synchronously.\n *\n * @param base - The base path to list keys from.\n * @returns An array of keys under the specified base path.\n */\n public listSync(base?: string): string[] {\n return [\n ...this.data\n .keys()\n .filter(key => (!base ? true : isParentPath(key, this.resolve(base))))\n ];\n }\n\n /**\n * Disposes of the storage adapter, releasing any held resources.\n *\n * @returns A promise that resolves when the disposal is complete.\n */\n public override async dispose(): Promise<void> {\n return this.clear();\n }\n\n /**\n * Determines if the storage adapter should overwrite existing keys based on the provided options and context configuration.\n *\n * @returns `true` if the storage adapter should overwrite existing keys, otherwise `false`.\n */\n protected override get overwrite() {\n return !this.isReadOnly;\n }\n}\n"],"mappings":";;;;;;;AAyBA,IAAa,wBAAb,cAA2C,mBAAmB;;;;CAI5D,AAAO,OAAO;;;;;;;CAQd,AAAyB,SAAS;;;;CAKlC,AAAU,uBAAO,IAAI,KAAkB;;;;;;;CAQvC,AAAO,YAAY,SAAkB,SAAiC;AACpE,QAAM,SAAS,QAAQ;;;;;;;;CASzB,AAAO,WAAW,KAAsB;AACtC,SAAO,KAAK,KAAK,IAAI,KAAK,QAAQ,IAAI,CAAC;;;;;;;;CASzC,AAAO,QAAQ,KAA4B;AACzC,SAAO,KAAK,KAAK,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI;;;;;;;;CAS7C,AAAO,QAAQ,KAAa,OAAe;AACzC,MAAI,CAAC,KAAK,eAAe,CAAC,KAAK,WAAW,IAAI,IAAI,KAAK,WACrD,MAAK,KAAK,IAAI,KAAK,QAAQ,IAAI,EAAE,MAAM;;;;;;;CAS3C,AAAO,WAAW,KAAa;AAC7B,MAAI,CAAC,KAAK,cAAc,KAAK,UAC3B,MAAK,KAAK,OAAO,KAAK,QAAQ,IAAI,CAAC;;;;;;;;CAUvC,AAAO,SAAS,MAAyB;AACvC,SAAO,CACL,GAAG,KAAK,KACL,MAAM,CACN,QAAO,QAAQ,CAAC,OAAO,OAAO,aAAa,KAAK,KAAK,QAAQ,KAAK,CAAC,CAAE,CACzE;;;;;;;CAQH,MAAsB,UAAyB;AAC7C,SAAO,KAAK,OAAO;;;;;;;CAQrB,IAAuB,YAAY;AACjC,SAAO,CAAC,KAAK"}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-C0xms8kb.cjs');
|
|
2
|
-
let defu = require("defu");
|
|
3
|
-
defu = require_chunk.__toESM(defu, 1);
|
|
4
|
-
let ts_morph = require("ts-morph");
|
|
5
|
-
|
|
6
|
-
//#region src/typescript/ts-morph.ts
|
|
7
|
-
var VirtualFileSystemHost = class extends ts_morph.InMemoryFileSystemHost {
|
|
8
|
-
#context;
|
|
9
|
-
constructor(context) {
|
|
10
|
-
super();
|
|
11
|
-
this.#context = context;
|
|
12
|
-
}
|
|
13
|
-
deleteSync(path) {
|
|
14
|
-
this.#context.fs.removeSync(path);
|
|
15
|
-
}
|
|
16
|
-
readDirSync(dirPath) {
|
|
17
|
-
if (!this.#context.fs.isDirectorySync(dirPath)) return [];
|
|
18
|
-
return this.#context.fs.listSync(dirPath).reduce((ret, entry) => {
|
|
19
|
-
const fullPath = this.#context.fs.resolveSync(entry);
|
|
20
|
-
if (fullPath) ret.push({
|
|
21
|
-
name: entry,
|
|
22
|
-
isDirectory: this.#context.fs.isDirectorySync(fullPath),
|
|
23
|
-
isFile: this.#context.fs.isFileSync(fullPath),
|
|
24
|
-
isSymlink: false
|
|
25
|
-
});
|
|
26
|
-
return ret;
|
|
27
|
-
}, []);
|
|
28
|
-
}
|
|
29
|
-
async readFile(filePath) {
|
|
30
|
-
if (!this.#context.fs.isFileSync(filePath)) return "";
|
|
31
|
-
return await this.#context.fs.read(filePath);
|
|
32
|
-
}
|
|
33
|
-
readFileSync(filePath) {
|
|
34
|
-
if (!this.#context.fs.isFileSync(filePath)) return "";
|
|
35
|
-
return this.#context.fs.readSync(filePath);
|
|
36
|
-
}
|
|
37
|
-
async writeFile(filePath, fileText) {
|
|
38
|
-
return this.#context.fs.write(filePath, fileText);
|
|
39
|
-
}
|
|
40
|
-
writeFileSync(filePath, fileText) {
|
|
41
|
-
this.#context.fs.writeSync(filePath, fileText);
|
|
42
|
-
}
|
|
43
|
-
async mkdir(dirPath) {
|
|
44
|
-
await this.#context.fs.mkdir(dirPath);
|
|
45
|
-
}
|
|
46
|
-
mkdirSync(dirPath) {
|
|
47
|
-
this.#context.fs.mkdirSync(dirPath);
|
|
48
|
-
}
|
|
49
|
-
async move(srcPath, destPath) {
|
|
50
|
-
await this.#context.fs.move(srcPath, destPath);
|
|
51
|
-
}
|
|
52
|
-
moveSync(srcPath, destPath) {
|
|
53
|
-
this.#context.fs.moveSync(srcPath, destPath);
|
|
54
|
-
}
|
|
55
|
-
async copy(srcPath, destPath) {
|
|
56
|
-
await this.#context.fs.copy(srcPath, destPath);
|
|
57
|
-
}
|
|
58
|
-
copySync(srcPath, destPath) {
|
|
59
|
-
this.#context.fs.copySync(srcPath, destPath);
|
|
60
|
-
}
|
|
61
|
-
async fileExists(filePath) {
|
|
62
|
-
return this.#context.fs.isFile(filePath);
|
|
63
|
-
}
|
|
64
|
-
fileExistsSync(filePath) {
|
|
65
|
-
return this.#context.fs.isFileSync(filePath);
|
|
66
|
-
}
|
|
67
|
-
async directoryExists(dirPath) {
|
|
68
|
-
return this.#context.fs.isDirectory(dirPath);
|
|
69
|
-
}
|
|
70
|
-
directoryExistsSync(dirPath) {
|
|
71
|
-
return this.#context.fs.isDirectorySync(dirPath);
|
|
72
|
-
}
|
|
73
|
-
realpathSync(path) {
|
|
74
|
-
return this.#context.fs.resolveSync(path) || path;
|
|
75
|
-
}
|
|
76
|
-
getCurrentDirectory() {
|
|
77
|
-
return this.#context.config.cwd;
|
|
78
|
-
}
|
|
79
|
-
async glob(patterns) {
|
|
80
|
-
return this.#context.fs.glob(patterns);
|
|
81
|
-
}
|
|
82
|
-
globSync(patterns) {
|
|
83
|
-
return this.#context.fs.globSync(patterns);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* Create a ts-morph {@link Project} instance used for type reflection and module manipulation during processing
|
|
88
|
-
*
|
|
89
|
-
* @param context - The Powerlines context
|
|
90
|
-
* @returns A ts-morph {@link Project} instance
|
|
91
|
-
*/
|
|
92
|
-
function createProgram(context, override) {
|
|
93
|
-
context.debug(`Creating ts-morph Project instance with configuration from: ${context.tsconfig.tsconfigFilePath}.`);
|
|
94
|
-
return new ts_morph.Project((0, defu.default)(override ?? {}, {
|
|
95
|
-
skipAddingFilesFromTsConfig: false,
|
|
96
|
-
tsConfigFilePath: context.tsconfig.tsconfigFilePath,
|
|
97
|
-
fileSystem: new VirtualFileSystemHost(context),
|
|
98
|
-
compilerOptions: (0, defu.default)(context.tsconfig.options ?? {}, { lib: ["lib.esnext.full.d.ts"] })
|
|
99
|
-
}));
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
//#endregion
|
|
103
|
-
Object.defineProperty(exports, 'VirtualFileSystemHost', {
|
|
104
|
-
enumerable: true,
|
|
105
|
-
get: function () {
|
|
106
|
-
return VirtualFileSystemHost;
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
Object.defineProperty(exports, 'createProgram', {
|
|
110
|
-
enumerable: true,
|
|
111
|
-
get: function () {
|
|
112
|
-
return createProgram;
|
|
113
|
-
}
|
|
114
|
-
});
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import defu from "defu";
|
|
2
|
-
import { InMemoryFileSystemHost, Project } from "ts-morph";
|
|
3
|
-
|
|
4
|
-
//#region src/typescript/ts-morph.ts
|
|
5
|
-
var VirtualFileSystemHost = class extends InMemoryFileSystemHost {
|
|
6
|
-
#context;
|
|
7
|
-
constructor(context) {
|
|
8
|
-
super();
|
|
9
|
-
this.#context = context;
|
|
10
|
-
}
|
|
11
|
-
deleteSync(path) {
|
|
12
|
-
this.#context.fs.removeSync(path);
|
|
13
|
-
}
|
|
14
|
-
readDirSync(dirPath) {
|
|
15
|
-
if (!this.#context.fs.isDirectorySync(dirPath)) return [];
|
|
16
|
-
return this.#context.fs.listSync(dirPath).reduce((ret, entry) => {
|
|
17
|
-
const fullPath = this.#context.fs.resolveSync(entry);
|
|
18
|
-
if (fullPath) ret.push({
|
|
19
|
-
name: entry,
|
|
20
|
-
isDirectory: this.#context.fs.isDirectorySync(fullPath),
|
|
21
|
-
isFile: this.#context.fs.isFileSync(fullPath),
|
|
22
|
-
isSymlink: false
|
|
23
|
-
});
|
|
24
|
-
return ret;
|
|
25
|
-
}, []);
|
|
26
|
-
}
|
|
27
|
-
async readFile(filePath) {
|
|
28
|
-
if (!this.#context.fs.isFileSync(filePath)) return "";
|
|
29
|
-
return await this.#context.fs.read(filePath);
|
|
30
|
-
}
|
|
31
|
-
readFileSync(filePath) {
|
|
32
|
-
if (!this.#context.fs.isFileSync(filePath)) return "";
|
|
33
|
-
return this.#context.fs.readSync(filePath);
|
|
34
|
-
}
|
|
35
|
-
async writeFile(filePath, fileText) {
|
|
36
|
-
return this.#context.fs.write(filePath, fileText);
|
|
37
|
-
}
|
|
38
|
-
writeFileSync(filePath, fileText) {
|
|
39
|
-
this.#context.fs.writeSync(filePath, fileText);
|
|
40
|
-
}
|
|
41
|
-
async mkdir(dirPath) {
|
|
42
|
-
await this.#context.fs.mkdir(dirPath);
|
|
43
|
-
}
|
|
44
|
-
mkdirSync(dirPath) {
|
|
45
|
-
this.#context.fs.mkdirSync(dirPath);
|
|
46
|
-
}
|
|
47
|
-
async move(srcPath, destPath) {
|
|
48
|
-
await this.#context.fs.move(srcPath, destPath);
|
|
49
|
-
}
|
|
50
|
-
moveSync(srcPath, destPath) {
|
|
51
|
-
this.#context.fs.moveSync(srcPath, destPath);
|
|
52
|
-
}
|
|
53
|
-
async copy(srcPath, destPath) {
|
|
54
|
-
await this.#context.fs.copy(srcPath, destPath);
|
|
55
|
-
}
|
|
56
|
-
copySync(srcPath, destPath) {
|
|
57
|
-
this.#context.fs.copySync(srcPath, destPath);
|
|
58
|
-
}
|
|
59
|
-
async fileExists(filePath) {
|
|
60
|
-
return this.#context.fs.isFile(filePath);
|
|
61
|
-
}
|
|
62
|
-
fileExistsSync(filePath) {
|
|
63
|
-
return this.#context.fs.isFileSync(filePath);
|
|
64
|
-
}
|
|
65
|
-
async directoryExists(dirPath) {
|
|
66
|
-
return this.#context.fs.isDirectory(dirPath);
|
|
67
|
-
}
|
|
68
|
-
directoryExistsSync(dirPath) {
|
|
69
|
-
return this.#context.fs.isDirectorySync(dirPath);
|
|
70
|
-
}
|
|
71
|
-
realpathSync(path) {
|
|
72
|
-
return this.#context.fs.resolveSync(path) || path;
|
|
73
|
-
}
|
|
74
|
-
getCurrentDirectory() {
|
|
75
|
-
return this.#context.config.cwd;
|
|
76
|
-
}
|
|
77
|
-
async glob(patterns) {
|
|
78
|
-
return this.#context.fs.glob(patterns);
|
|
79
|
-
}
|
|
80
|
-
globSync(patterns) {
|
|
81
|
-
return this.#context.fs.globSync(patterns);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Create a ts-morph {@link Project} instance used for type reflection and module manipulation during processing
|
|
86
|
-
*
|
|
87
|
-
* @param context - The Powerlines context
|
|
88
|
-
* @returns A ts-morph {@link Project} instance
|
|
89
|
-
*/
|
|
90
|
-
function createProgram(context, override) {
|
|
91
|
-
context.debug(`Creating ts-morph Project instance with configuration from: ${context.tsconfig.tsconfigFilePath}.`);
|
|
92
|
-
return new Project(defu(override ?? {}, {
|
|
93
|
-
skipAddingFilesFromTsConfig: false,
|
|
94
|
-
tsConfigFilePath: context.tsconfig.tsconfigFilePath,
|
|
95
|
-
fileSystem: new VirtualFileSystemHost(context),
|
|
96
|
-
compilerOptions: defu(context.tsconfig.options ?? {}, { lib: ["lib.esnext.full.d.ts"] })
|
|
97
|
-
}));
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
//#endregion
|
|
101
|
-
export { createProgram as n, VirtualFileSystemHost as t };
|
|
102
|
-
//# sourceMappingURL=ts-morph-C6YBNc46.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ts-morph-C6YBNc46.mjs","names":["#context"],"sources":["../src/typescript/ts-morph.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Context } from \"@powerlines/core\";\nimport defu from \"defu\";\nimport {\n CompilerOptions,\n FileSystemHost,\n InMemoryFileSystemHost,\n Project,\n ProjectOptions,\n RuntimeDirEntry\n} from \"ts-morph\";\n\nexport class VirtualFileSystemHost\n extends InMemoryFileSystemHost\n implements FileSystemHost\n{\n #context: Context;\n\n public constructor(context: Context) {\n super();\n\n this.#context = context;\n }\n\n public override deleteSync(path: string) {\n this.#context.fs.removeSync(path);\n }\n\n public override readDirSync(dirPath: string): RuntimeDirEntry[] {\n if (!this.#context.fs.isDirectorySync(dirPath)) {\n return [];\n }\n\n return this.#context.fs.listSync(dirPath).reduce((ret, entry) => {\n const fullPath = this.#context.fs.resolveSync(entry);\n if (fullPath) {\n ret.push({\n name: entry,\n isDirectory: this.#context.fs.isDirectorySync(fullPath),\n isFile: this.#context.fs.isFileSync(fullPath),\n isSymlink: false\n });\n }\n\n return ret;\n }, [] as RuntimeDirEntry[]);\n }\n\n public override async readFile(filePath: string) {\n if (!this.#context.fs.isFileSync(filePath)) {\n return \"\";\n }\n\n return (await this.#context.fs.read(filePath))!;\n }\n\n public override readFileSync(filePath: string) {\n if (!this.#context.fs.isFileSync(filePath)) {\n return \"\";\n }\n\n return this.#context.fs.readSync(filePath)!;\n }\n\n public override async writeFile(filePath: string, fileText: string) {\n return this.#context.fs.write(filePath, fileText);\n }\n\n public override writeFileSync(filePath: string, fileText: string) {\n this.#context.fs.writeSync(filePath, fileText);\n }\n\n public override async mkdir(dirPath: string) {\n await this.#context.fs.mkdir(dirPath);\n }\n\n public override mkdirSync(dirPath: string) {\n this.#context.fs.mkdirSync(dirPath);\n }\n\n public override async move(srcPath: string, destPath: string) {\n await this.#context.fs.move(srcPath, destPath);\n }\n\n public override moveSync(srcPath: string, destPath: string) {\n this.#context.fs.moveSync(srcPath, destPath);\n }\n\n public override async copy(srcPath: string, destPath: string) {\n await this.#context.fs.copy(srcPath, destPath);\n }\n\n public override copySync(srcPath: string, destPath: string) {\n this.#context.fs.copySync(srcPath, destPath);\n }\n\n public override async fileExists(filePath: string) {\n return this.#context.fs.isFile(filePath);\n }\n\n public override fileExistsSync(filePath: string) {\n return this.#context.fs.isFileSync(filePath);\n }\n\n public override async directoryExists(dirPath: string) {\n return this.#context.fs.isDirectory(dirPath);\n }\n\n public override directoryExistsSync(dirPath: string): boolean {\n return this.#context.fs.isDirectorySync(dirPath);\n }\n\n public override realpathSync(path: string) {\n return this.#context.fs.resolveSync(path) || path;\n }\n\n public override getCurrentDirectory() {\n return this.#context.config.cwd;\n }\n\n public override async glob(\n patterns: ReadonlyArray<string>\n ): Promise<string[]> {\n return this.#context.fs.glob(patterns as string[]);\n }\n\n public override globSync(patterns: ReadonlyArray<string>): string[] {\n return this.#context.fs.globSync(patterns as string[]);\n }\n}\n\n/**\n * Create a ts-morph {@link Project} instance used for type reflection and module manipulation during processing\n *\n * @param context - The Powerlines context\n * @returns A ts-morph {@link Project} instance\n */\nexport function createProgram(\n context: Context,\n override: Partial<ProjectOptions>\n): Project {\n context.debug(\n `Creating ts-morph Project instance with configuration from: ${\n context.tsconfig.tsconfigFilePath\n }.`\n );\n\n const project = new Project(\n defu(override ?? {}, {\n skipAddingFilesFromTsConfig: false,\n tsConfigFilePath: context.tsconfig.tsconfigFilePath,\n fileSystem: new VirtualFileSystemHost(context),\n compilerOptions: defu(context.tsconfig.options ?? {}, {\n lib: [\"lib.esnext.full.d.ts\"]\n }) as CompilerOptions\n })\n );\n\n return project;\n}\n"],"mappings":"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"}
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-C0xms8kb.cjs');
|
|
2
|
-
let _stryke_fs_exists = require("@stryke/fs/exists");
|
|
3
|
-
let _stryke_path_append = require("@stryke/path/append");
|
|
4
|
-
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
5
|
-
let defu = require("defu");
|
|
6
|
-
defu = require_chunk.__toESM(defu, 1);
|
|
7
|
-
let _stryke_fs_json = require("@stryke/fs/json");
|
|
8
|
-
let typescript = require("typescript");
|
|
9
|
-
typescript = require_chunk.__toESM(typescript, 1);
|
|
10
|
-
|
|
11
|
-
//#region src/typescript/tsconfig.ts
|
|
12
|
-
/**
|
|
13
|
-
* Get the path to the tsconfig.json file.
|
|
14
|
-
*
|
|
15
|
-
* @param cwd - The root directory of the workspace.
|
|
16
|
-
* @param root - The root directory of the project.
|
|
17
|
-
* @param tsconfig - The path to the tsconfig.json file.
|
|
18
|
-
* @returns The absolute path to the tsconfig.json file.
|
|
19
|
-
* @throws If the tsconfig.json file does not exist.
|
|
20
|
-
*/
|
|
21
|
-
function getTsconfigFilePath(cwd, root, tsconfig) {
|
|
22
|
-
let tsconfigFilePath;
|
|
23
|
-
if (tsconfig) tsconfigFilePath = tryTsconfigFilePath(cwd, root, tsconfig);
|
|
24
|
-
else {
|
|
25
|
-
tsconfigFilePath = tryTsconfigFilePath(cwd, root, "tsconfig.app.json");
|
|
26
|
-
if (!tsconfigFilePath) {
|
|
27
|
-
tsconfigFilePath = tryTsconfigFilePath(cwd, root, "tsconfig.lib.json");
|
|
28
|
-
if (!tsconfigFilePath) tsconfigFilePath = tryTsconfigFilePath(cwd, root, "tsconfig.json");
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if (!tsconfigFilePath) throw new Error(`Cannot find the \`tsconfig.json\` configuration file for the project at ${root}.`);
|
|
32
|
-
return tsconfigFilePath;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Get the path to the tsconfig.json file.
|
|
36
|
-
*
|
|
37
|
-
* @param cwd - The root directory of the workspace.
|
|
38
|
-
* @param root - The root directory of the project.
|
|
39
|
-
* @param tsconfig - The path to the tsconfig.json file.
|
|
40
|
-
* @returns The absolute path to the tsconfig.json file.
|
|
41
|
-
* @throws If the tsconfig.json file does not exist.
|
|
42
|
-
*/
|
|
43
|
-
function tryTsconfigFilePath(cwd, root, tsconfig) {
|
|
44
|
-
let tsconfigFilePath = tsconfig;
|
|
45
|
-
if (!(0, _stryke_fs_exists.existsSync)(tsconfigFilePath)) {
|
|
46
|
-
tsconfigFilePath = (0, _stryke_path_append.appendPath)(tsconfig, root);
|
|
47
|
-
if (!(0, _stryke_fs_exists.existsSync)(tsconfigFilePath)) {
|
|
48
|
-
tsconfigFilePath = (0, _stryke_path_append.appendPath)(tsconfig, (0, _stryke_path_append.appendPath)(root, cwd));
|
|
49
|
-
if (!(0, _stryke_fs_exists.existsSync)(tsconfigFilePath)) return;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return tsconfigFilePath;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Check if the TypeScript configuration type matches any of the provided types.
|
|
56
|
-
*
|
|
57
|
-
* @param tsconfigType - The type from the TypeScript configuration.
|
|
58
|
-
* @param types - An array of type names to check against.
|
|
59
|
-
* @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
|
|
60
|
-
*/
|
|
61
|
-
function findMatch(tsconfigType, types, extensions = [
|
|
62
|
-
".ts",
|
|
63
|
-
".tsx",
|
|
64
|
-
".d.ts"
|
|
65
|
-
]) {
|
|
66
|
-
return types.find((type) => tsconfigType?.toString().toLowerCase() === type?.toString().toLowerCase() || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}` || `./${tsconfigType?.toString().toLowerCase()}` === type?.toString().toLowerCase() || extensions.some((ext) => `${tsconfigType?.toString().toLowerCase()}${ext}` === type?.toString().toLowerCase() || `${tsconfigType?.toString().toLowerCase()}${ext}` === `./${type?.toString().toLowerCase()}` || `${type?.toString().toLowerCase()}${ext}` === `./${tsconfigType?.toString().toLowerCase()}` || tsconfigType?.toString().toLowerCase() === `${type?.toString().toLowerCase()}${ext}` || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}${ext}` || type?.toString().toLowerCase() === `./${tsconfigType?.toString().toLowerCase()}${ext}`));
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Check if the TypeScript configuration type matches any of the provided types.
|
|
70
|
-
*
|
|
71
|
-
* @param tsconfigType - The type from the TypeScript configuration.
|
|
72
|
-
* @param types - An array of type names to check against.
|
|
73
|
-
* @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
|
|
74
|
-
*/
|
|
75
|
-
function findIncludeMatch(tsconfigType, types) {
|
|
76
|
-
return findMatch(tsconfigType, types, [
|
|
77
|
-
".ts",
|
|
78
|
-
".tsx",
|
|
79
|
-
".d.ts",
|
|
80
|
-
".js",
|
|
81
|
-
".jsx",
|
|
82
|
-
".mjs",
|
|
83
|
-
".cjs",
|
|
84
|
-
".mts",
|
|
85
|
-
".cts",
|
|
86
|
-
"/*.ts",
|
|
87
|
-
"/*.tsx",
|
|
88
|
-
"/*.d.ts",
|
|
89
|
-
"/*.js",
|
|
90
|
-
"/*.jsx",
|
|
91
|
-
"/*.mjs",
|
|
92
|
-
"/*.cjs",
|
|
93
|
-
"/*.mts",
|
|
94
|
-
"/*.cts",
|
|
95
|
-
"/**/*.ts",
|
|
96
|
-
"/**/*.tsx",
|
|
97
|
-
"/**/*.d.ts",
|
|
98
|
-
"/**/*.js",
|
|
99
|
-
"/**/*.jsx",
|
|
100
|
-
"/**/*.mjs",
|
|
101
|
-
"/**/*.cjs",
|
|
102
|
-
"/**/*.mts",
|
|
103
|
-
"/**/*.cts"
|
|
104
|
-
]);
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Check if the TypeScript configuration type matches any of the provided types.
|
|
108
|
-
*
|
|
109
|
-
* @param tsconfigType - The type from the TypeScript configuration.
|
|
110
|
-
* @param types - An array of type names to check against.
|
|
111
|
-
* @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
|
|
112
|
-
*/
|
|
113
|
-
function isMatchFound(tsconfigType, types) {
|
|
114
|
-
return findMatch(tsconfigType, types) !== void 0;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Check if the TypeScript configuration type matches any of the provided types.
|
|
118
|
-
*
|
|
119
|
-
* @param tsconfigType - The type from the TypeScript configuration.
|
|
120
|
-
* @param types - An array of type names to check against.
|
|
121
|
-
* @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
|
|
122
|
-
*/
|
|
123
|
-
function isIncludeMatchFound(tsconfigType, types) {
|
|
124
|
-
return findIncludeMatch(tsconfigType, types) !== void 0;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Get the parsed TypeScript configuration.
|
|
128
|
-
*
|
|
129
|
-
* @param workspaceRoot - The root directory of the workspace.
|
|
130
|
-
* @param projectRoot - The root directory of the project.
|
|
131
|
-
* @param tsconfig - The path to the tsconfig.json file.
|
|
132
|
-
* @param tsconfigRaw - The raw tsconfig.json content.
|
|
133
|
-
* @param originalTsconfigJson - The original tsconfig.json content.
|
|
134
|
-
* @param host - The TypeScript parse config host.
|
|
135
|
-
* @returns The resolved TypeScript configuration.
|
|
136
|
-
*/
|
|
137
|
-
function getParsedTypeScriptConfig(workspaceRoot, projectRoot, tsconfig, tsconfigRaw = {}, originalTsconfigJson, host = typescript.default.sys) {
|
|
138
|
-
const tsconfigFilePath = getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig);
|
|
139
|
-
const tsconfigJson = (0, _stryke_fs_json.readJsonFileSync)(tsconfigFilePath);
|
|
140
|
-
if (!tsconfigJson) throw new Error(`Cannot find the \`tsconfig.json\` configuration file at ${(0, _stryke_path_join_paths.joinPaths)(projectRoot, tsconfig ?? "tsconfig.json")}`);
|
|
141
|
-
const parsedCommandLine = typescript.default.parseJsonConfigFileContent((0, defu.default)(tsconfigRaw ?? {}, tsconfigJson), host, (0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot));
|
|
142
|
-
if (parsedCommandLine.errors.length > 0) {
|
|
143
|
-
const errorMessage = `Cannot parse the TypeScript compiler options. Please investigate the following issues:
|
|
144
|
-
${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && error.code ? `[${error.category}-${error.code}]: ` : "") + error.messageText.toString()}`).join("\n")}
|
|
145
|
-
`;
|
|
146
|
-
throw new Error(errorMessage);
|
|
147
|
-
}
|
|
148
|
-
return {
|
|
149
|
-
...parsedCommandLine,
|
|
150
|
-
originalTsconfigJson: originalTsconfigJson ?? tsconfigJson,
|
|
151
|
-
tsconfigJson,
|
|
152
|
-
tsconfigFilePath
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
//#endregion
|
|
157
|
-
Object.defineProperty(exports, 'findIncludeMatch', {
|
|
158
|
-
enumerable: true,
|
|
159
|
-
get: function () {
|
|
160
|
-
return findIncludeMatch;
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
Object.defineProperty(exports, 'findMatch', {
|
|
164
|
-
enumerable: true,
|
|
165
|
-
get: function () {
|
|
166
|
-
return findMatch;
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
Object.defineProperty(exports, 'getParsedTypeScriptConfig', {
|
|
170
|
-
enumerable: true,
|
|
171
|
-
get: function () {
|
|
172
|
-
return getParsedTypeScriptConfig;
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
Object.defineProperty(exports, 'getTsconfigFilePath', {
|
|
176
|
-
enumerable: true,
|
|
177
|
-
get: function () {
|
|
178
|
-
return getTsconfigFilePath;
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
Object.defineProperty(exports, 'isIncludeMatchFound', {
|
|
182
|
-
enumerable: true,
|
|
183
|
-
get: function () {
|
|
184
|
-
return isIncludeMatchFound;
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
Object.defineProperty(exports, 'isMatchFound', {
|
|
188
|
-
enumerable: true,
|
|
189
|
-
get: function () {
|
|
190
|
-
return isMatchFound;
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
Object.defineProperty(exports, 'tryTsconfigFilePath', {
|
|
194
|
-
enumerable: true,
|
|
195
|
-
get: function () {
|
|
196
|
-
return tryTsconfigFilePath;
|
|
197
|
-
}
|
|
198
|
-
});
|