@halospv3/hce.shared-config 2.6.4 → 3.0.0-develop.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +452 -101
- package/README.md +100 -87
- package/dotnet/.github/workflows/_unit_test.yml +3 -3
- package/dotnet/.github/workflows/ci.yml +2 -2
- package/dotnet/.github/workflows/dotnet-release.yml +28 -28
- package/dotnet/.github/workflows/sample-dotnet-build.yml +13 -11
- package/dotnet/ExecNupkgDeterministicator.README.md +20 -0
- package/dotnet/ExecNupkgDeterministicator.targets +173 -0
- package/dotnet/GitVersion.yml +3 -1
- package/dotnet/GitVersion6.0.yml +3 -1
- package/dotnet/HCE.Shared.sln +34 -0
- package/dotnet/HCE.Shared.targets +1 -0
- package/dotnet/PublishAll.targets +2 -0
- package/dotnet/SignAfterPack.targets +104 -0
- package/dotnet/samples/HCE.Shared.DeterministicNupkg/Dummy.cs +6 -0
- package/dotnet/samples/HCE.Shared.DeterministicNupkg/HCE.Shared.DeterministicNupkg.csproj +21 -0
- package/dotnet/samples/HCE.Shared.SignAfterPack/Class1.cs +6 -0
- package/dotnet/samples/HCE.Shared.SignAfterPack/HCE.Shared.SignAfterPack.csproj +21 -0
- package/dotnet/samples/HCE.Shared.SignAfterPack/sampleCert.samplepfx +0 -0
- package/dotnet/samples/README.md +7 -0
- package/mjs/CaseInsensitiveMap.d.ts +12 -0
- package/mjs/CaseInsensitiveMap.d.ts.map +1 -0
- package/mjs/CaseInsensitiveMap.mjs +33 -0
- package/mjs/CaseInsensitiveMap.mjs.map +1 -0
- package/mjs/commitlintConfig.d.ts +12 -0
- package/mjs/commitlintConfig.d.ts.map +1 -0
- package/{cjs/commitlintConfig.cjs → mjs/commitlintConfig.mjs} +3 -4
- package/mjs/commitlintConfig.mjs.map +1 -0
- package/mjs/debug.d.ts +4 -0
- package/{cjs → mjs}/debug.d.ts.map +1 -1
- package/mjs/debug.mjs +7 -0
- package/mjs/debug.mjs.map +1 -0
- package/mjs/dotnet/GithubNugetRegistryInfo.d.ts +38 -0
- package/mjs/dotnet/GithubNugetRegistryInfo.d.ts.map +1 -0
- package/mjs/dotnet/GithubNugetRegistryInfo.mjs +43 -0
- package/mjs/dotnet/GithubNugetRegistryInfo.mjs.map +1 -0
- package/mjs/dotnet/GitlabNugetRegistryInfo.d.ts +62 -0
- package/mjs/dotnet/GitlabNugetRegistryInfo.d.ts.map +1 -0
- package/mjs/dotnet/GitlabNugetRegistryInfo.mjs +99 -0
- package/mjs/dotnet/GitlabNugetRegistryInfo.mjs.map +1 -0
- package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.d.ts +2 -0
- package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.d.ts.map +1 -0
- package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs +26 -0
- package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs.map +1 -0
- package/mjs/dotnet/MSBuildProject.d.ts +256 -0
- package/mjs/dotnet/MSBuildProject.d.ts.map +1 -0
- package/mjs/dotnet/MSBuildProject.mjs +447 -0
- package/mjs/dotnet/MSBuildProject.mjs.map +1 -0
- package/mjs/dotnet/MSBuildProjectProperties.d.ts +170 -0
- package/mjs/dotnet/MSBuildProjectProperties.d.ts.map +1 -0
- package/mjs/dotnet/MSBuildProjectProperties.mjs +260 -0
- package/mjs/dotnet/MSBuildProjectProperties.mjs.map +1 -0
- package/mjs/dotnet/NugetProjectProperties.d.ts +379 -0
- package/mjs/dotnet/NugetProjectProperties.d.ts.map +1 -0
- package/mjs/dotnet/NugetProjectProperties.mjs +577 -0
- package/mjs/dotnet/NugetProjectProperties.mjs.map +1 -0
- package/mjs/dotnet/NugetRegistryInfo.d.ts +384 -0
- package/mjs/dotnet/NugetRegistryInfo.d.ts.map +1 -0
- package/mjs/dotnet/NugetRegistryInfo.mjs +752 -0
- package/mjs/dotnet/NugetRegistryInfo.mjs.map +1 -0
- package/mjs/dotnet/helpers.d.ts +63 -0
- package/mjs/dotnet/helpers.d.ts.map +1 -0
- package/mjs/dotnet/helpers.mjs +354 -0
- package/mjs/dotnet/helpers.mjs.map +1 -0
- package/mjs/dotnet/index.d.ts +17 -0
- package/mjs/dotnet/index.d.ts.map +1 -0
- package/mjs/dotnet/index.mjs +9 -0
- package/mjs/dotnet/index.mjs.map +1 -0
- package/mjs/dotnet.d.ts +3 -0
- package/mjs/dotnet.d.ts.map +1 -0
- package/mjs/dotnet.mjs +9 -0
- package/mjs/dotnet.mjs.map +1 -0
- package/mjs/eslintConfig.d.ts +4 -0
- package/mjs/eslintConfig.d.ts.map +1 -0
- package/mjs/eslintConfig.mjs +98 -0
- package/mjs/eslintConfig.mjs.map +1 -0
- package/mjs/index.d.ts +3 -0
- package/mjs/index.d.ts.map +1 -0
- package/mjs/index.mjs +4 -0
- package/mjs/index.mjs.map +1 -0
- package/mjs/insertPlugins.d.ts +18 -0
- package/mjs/insertPlugins.d.ts.map +1 -0
- package/mjs/insertPlugins.mjs +73 -0
- package/mjs/insertPlugins.mjs.map +1 -0
- package/mjs/semantic-release__commit-analyzer.d.mjs +2 -0
- package/mjs/semantic-release__commit-analyzer.d.mjs.map +1 -0
- package/mjs/semantic-release__exec.d.mjs +2 -0
- package/mjs/semantic-release__exec.d.mjs.map +1 -0
- package/mjs/semantic-release__git.d.mjs +2 -0
- package/mjs/semantic-release__git.d.mjs.map +1 -0
- package/mjs/semantic-release__github.d.mjs +2 -0
- package/mjs/semantic-release__github.d.mjs.map +1 -0
- package/mjs/semanticReleaseConfig.d.ts +97 -0
- package/mjs/semanticReleaseConfig.d.ts.map +1 -0
- package/mjs/semanticReleaseConfig.mjs +63 -0
- package/mjs/semanticReleaseConfig.mjs.map +1 -0
- package/mjs/semanticReleaseConfigDotnet.d.ts +109 -0
- package/mjs/semanticReleaseConfigDotnet.d.ts.map +1 -0
- package/mjs/semanticReleaseConfigDotnet.mjs +267 -0
- package/mjs/semanticReleaseConfigDotnet.mjs.map +1 -0
- package/mjs/setupGitPluginSpec.d.ts +22 -0
- package/mjs/setupGitPluginSpec.d.ts.map +1 -0
- package/mjs/setupGitPluginSpec.mjs +144 -0
- package/mjs/setupGitPluginSpec.mjs.map +1 -0
- package/mjs/utils/Exact.d.ts +20 -0
- package/mjs/utils/Exact.d.ts.map +1 -0
- package/mjs/utils/Exact.mjs +75 -0
- package/mjs/utils/Exact.mjs.map +1 -0
- package/mjs/utils/GracefulRecursion.d.mjs +2 -0
- package/mjs/utils/GracefulRecursion.d.mjs.map +1 -0
- package/mjs/utils/env.d.ts +24 -0
- package/mjs/utils/env.d.ts.map +1 -0
- package/mjs/utils/env.mjs +39 -0
- package/mjs/utils/env.mjs.map +1 -0
- package/mjs/utils/execAsync.d.ts +37 -0
- package/mjs/utils/execAsync.d.ts.map +1 -0
- package/mjs/utils/execAsync.mjs +59 -0
- package/mjs/utils/execAsync.mjs.map +1 -0
- package/mjs/utils/miscTypes.d.ts +13 -0
- package/mjs/utils/miscTypes.d.ts.map +1 -0
- package/mjs/utils/miscTypes.mjs +10 -0
- package/mjs/utils/miscTypes.mjs.map +1 -0
- package/mjs/utils/reflection/FunctionLike.d.mjs +2 -0
- package/mjs/utils/reflection/FunctionLike.d.mjs.map +1 -0
- package/mjs/utils/reflection/GetterDescriptor.d.mjs +2 -0
- package/mjs/utils/reflection/GetterDescriptor.d.mjs.map +1 -0
- package/mjs/utils/reflection/InstancePropertyDescriptorMap.d.mjs +2 -0
- package/mjs/utils/reflection/InstancePropertyDescriptorMap.d.mjs.map +1 -0
- package/mjs/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.mjs +2 -0
- package/mjs/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.mjs.map +1 -0
- package/mjs/utils/reflection/OwnGetterDescriptorMap.d.mjs +2 -0
- package/mjs/utils/reflection/OwnGetterDescriptorMap.d.mjs.map +1 -0
- package/mjs/utils/reflection/OwnKeyOf.d.mjs +2 -0
- package/mjs/utils/reflection/OwnKeyOf.d.mjs.map +1 -0
- package/mjs/utils/reflection/OwnPropertyDescriptorMap.d.mjs +2 -0
- package/mjs/utils/reflection/OwnPropertyDescriptorMap.d.mjs.map +1 -0
- package/mjs/utils/reflection/PropertyDescriptorMap.d.mjs +2 -0
- package/mjs/utils/reflection/PropertyDescriptorMap.d.mjs.map +1 -0
- package/mjs/utils/reflection/filterForGetters.d.ts +7 -0
- package/mjs/utils/reflection/filterForGetters.d.ts.map +1 -0
- package/mjs/utils/reflection/filterForGetters.mjs +27 -0
- package/mjs/utils/reflection/filterForGetters.mjs.map +1 -0
- package/mjs/utils/reflection/getOwnPropertyDescriptors.d.ts +22 -0
- package/mjs/utils/reflection/getOwnPropertyDescriptors.d.ts.map +1 -0
- package/mjs/utils/reflection/getOwnPropertyDescriptors.mjs +34 -0
- package/mjs/utils/reflection/getOwnPropertyDescriptors.mjs.map +1 -0
- package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.d.ts +56 -0
- package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.d.ts.map +1 -0
- package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.mjs +72 -0
- package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.mjs.map +1 -0
- package/mjs/utils/reflection/getPrototypeChainOf.d.ts +16 -0
- package/mjs/utils/reflection/getPrototypeChainOf.d.ts.map +1 -0
- package/mjs/utils/reflection/getPrototypeChainOf.mjs +55 -0
- package/mjs/utils/reflection/getPrototypeChainOf.mjs.map +1 -0
- package/mjs/utils/reflection/getPrototypeOf.d.ts +8 -0
- package/mjs/utils/reflection/getPrototypeOf.d.ts.map +1 -0
- package/mjs/utils/reflection/getPrototypeOf.mjs +10 -0
- package/mjs/utils/reflection/getPrototypeOf.mjs.map +1 -0
- package/mjs/utils/reflection/inheritance.d.ts +180 -0
- package/mjs/utils/reflection/inheritance.d.ts.map +1 -0
- package/mjs/utils/reflection/inheritance.mjs +148 -0
- package/mjs/utils/reflection/inheritance.mjs.map +1 -0
- package/mjs/utils/reflection/isConstructor.d.ts +17 -0
- package/mjs/utils/reflection/isConstructor.d.ts.map +1 -0
- package/mjs/utils/reflection/isConstructor.mjs +63 -0
- package/mjs/utils/reflection/isConstructor.mjs.map +1 -0
- package/mjs/utils/reflection/isGetterDescriptor.d.ts +9 -0
- package/mjs/utils/reflection/isGetterDescriptor.d.ts.map +1 -0
- package/mjs/utils/reflection/isGetterDescriptor.mjs +12 -0
- package/mjs/utils/reflection/isGetterDescriptor.mjs.map +1 -0
- package/mjs/utils/reflection/listOwnGetters.d.ts +26 -0
- package/mjs/utils/reflection/listOwnGetters.d.ts.map +1 -0
- package/mjs/utils/reflection/listOwnGetters.mjs +39 -0
- package/mjs/utils/reflection/listOwnGetters.mjs.map +1 -0
- package/mjs/utils/reflection.d.ts +18 -0
- package/mjs/utils/reflection.d.ts.map +1 -0
- package/mjs/utils/reflection.mjs +10 -0
- package/mjs/utils/reflection.mjs.map +1 -0
- package/package.json +77 -78
- package/src/CaseInsensitiveMap.ts +34 -0
- package/src/commitlintConfig.ts +17 -9
- package/src/debug.ts +4 -4
- package/src/dotnet/GithubNugetRegistryInfo.ts +68 -0
- package/src/dotnet/GitlabNugetRegistryInfo.ts +126 -0
- package/src/dotnet/IsNextVersionAlreadyPublished.cli.ts +44 -0
- package/src/dotnet/MSBuildProject.ts +702 -76
- package/src/dotnet/MSBuildProjectProperties.ts +281 -15
- package/src/dotnet/NugetProjectProperties.ts +609 -0
- package/src/dotnet/NugetRegistryInfo.ts +1025 -0
- package/src/dotnet/helpers.ts +479 -0
- package/src/dotnet/index.ts +17 -0
- package/src/dotnet.ts +2 -6
- package/src/eslintConfig.ts +174 -71
- package/src/index.ts +1 -3
- package/src/insertPlugins.ts +116 -0
- package/src/semantic-release__commit-analyzer.d.ts +44 -38
- package/src/semantic-release__exec.d.ts +15 -0
- package/src/semantic-release__git.d.ts +85 -88
- package/src/semantic-release__github.d.ts +139 -139
- package/src/semanticReleaseConfig.ts +111 -47
- package/src/semanticReleaseConfigDotnet.ts +397 -104
- package/src/setupGitPluginSpec.ts +153 -58
- package/src/tsconfig.json +8 -8
- package/src/utils/Exact.ts +49 -0
- package/src/utils/GracefulRecursion.d.ts +12 -0
- package/src/utils/env.ts +44 -0
- package/src/utils/execAsync.ts +89 -0
- package/src/utils/miscTypes.ts +18 -0
- package/src/utils/reflection/FunctionLike.d.ts +17 -0
- package/src/utils/reflection/GetterDescriptor.d.ts +8 -0
- package/src/utils/reflection/InstancePropertyDescriptorMap.d.ts +32 -0
- package/src/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.ts +20 -0
- package/src/utils/reflection/OwnGetterDescriptorMap.d.ts +17 -0
- package/src/utils/reflection/OwnKeyOf.d.ts +20 -0
- package/src/utils/reflection/OwnPropertyDescriptorMap.d.ts +82 -0
- package/src/utils/reflection/PropertyDescriptorMap.d.ts +15 -0
- package/src/utils/reflection/filterForGetters.ts +59 -0
- package/src/utils/reflection/getOwnPropertyDescriptors.ts +52 -0
- package/src/utils/reflection/getOwnPropertyDescriptorsRecursively.ts +127 -0
- package/src/utils/reflection/getPrototypeChainOf.ts +85 -0
- package/src/utils/reflection/getPrototypeOf.ts +12 -0
- package/src/utils/reflection/inheritance.ts +262 -0
- package/src/utils/reflection/isConstructor.ts +74 -0
- package/src/utils/reflection/isGetterDescriptor.ts +11 -0
- package/src/utils/reflection/listOwnGetters.ts +80 -0
- package/src/utils/reflection.ts +18 -0
- package/cjs/commitlintConfig-wrapper.mjs +0 -6
- package/cjs/commitlintConfig.cjs.map +0 -1
- package/cjs/commitlintConfig.d.ts +0 -4
- package/cjs/commitlintConfig.d.ts.map +0 -1
- package/cjs/debug.cjs +0 -13
- package/cjs/debug.cjs.map +0 -1
- package/cjs/debug.d.ts +0 -4
- package/cjs/dotnet/MSBuildProject.cjs +0 -84
- package/cjs/dotnet/MSBuildProject.cjs.map +0 -1
- package/cjs/dotnet/MSBuildProject.d.ts +0 -42
- package/cjs/dotnet/MSBuildProject.d.ts.map +0 -1
- package/cjs/dotnet/MSBuildProjectProperties.cjs +0 -22
- package/cjs/dotnet/MSBuildProjectProperties.cjs.map +0 -1
- package/cjs/dotnet/MSBuildProjectProperties.d.ts +0 -13
- package/cjs/dotnet/MSBuildProjectProperties.d.ts.map +0 -1
- package/cjs/dotnet/createDummyNupkg.cjs +0 -26
- package/cjs/dotnet/createDummyNupkg.cjs.map +0 -1
- package/cjs/dotnet/createDummyNupkg.d.ts +0 -2
- package/cjs/dotnet/createDummyNupkg.d.ts.map +0 -1
- package/cjs/dotnet/dotnetGHPR.cjs +0 -173
- package/cjs/dotnet/dotnetGHPR.cjs.map +0 -1
- package/cjs/dotnet/dotnetGHPR.d.ts +0 -37
- package/cjs/dotnet/dotnetGHPR.d.ts.map +0 -1
- package/cjs/dotnet/dotnetGLPR.cjs +0 -41
- package/cjs/dotnet/dotnetGLPR.cjs.map +0 -1
- package/cjs/dotnet/dotnetGLPR.d.ts +0 -13
- package/cjs/dotnet/dotnetGLPR.d.ts.map +0 -1
- package/cjs/dotnet/dotnetHelpers.cjs +0 -141
- package/cjs/dotnet/dotnetHelpers.cjs.map +0 -1
- package/cjs/dotnet/dotnetHelpers.d.ts +0 -26
- package/cjs/dotnet/dotnetHelpers.d.ts.map +0 -1
- package/cjs/dotnet-wrapper.mjs +0 -6
- package/cjs/dotnet.cjs +0 -15
- package/cjs/dotnet.cjs.map +0 -1
- package/cjs/dotnet.d.ts +0 -7
- package/cjs/dotnet.d.ts.map +0 -1
- package/cjs/envUtils-wrapper.mjs +0 -6
- package/cjs/envUtils.cjs +0 -37
- package/cjs/envUtils.cjs.map +0 -1
- package/cjs/envUtils.d.ts +0 -15
- package/cjs/envUtils.d.ts.map +0 -1
- package/cjs/eslintConfig-wrapper.mjs +0 -6
- package/cjs/eslintConfig.cjs +0 -52
- package/cjs/eslintConfig.cjs.map +0 -1
- package/cjs/eslintConfig.d.ts +0 -3
- package/cjs/eslintConfig.d.ts.map +0 -1
- package/cjs/findStaticConfig-wrapper.mjs +0 -6
- package/cjs/findStaticConfig.cjs +0 -34
- package/cjs/findStaticConfig.cjs.map +0 -1
- package/cjs/findStaticConfig.d.ts +0 -2
- package/cjs/findStaticConfig.d.ts.map +0 -1
- package/cjs/index-wrapper.mjs +0 -6
- package/cjs/index.cjs +0 -10
- package/cjs/index.cjs.map +0 -1
- package/cjs/index.d.ts +0 -5
- package/cjs/index.d.ts.map +0 -1
- package/cjs/semantic-release__commit-analyzer.d.cjs +0 -2
- package/cjs/semantic-release__commit-analyzer.d.cjs.map +0 -1
- package/cjs/semantic-release__git.d.cjs +0 -2
- package/cjs/semantic-release__git.d.cjs.map +0 -1
- package/cjs/semantic-release__github.d.cjs +0 -2
- package/cjs/semantic-release__github.d.cjs.map +0 -1
- package/cjs/semanticReleaseConfig-wrapper.mjs +0 -6
- package/cjs/semanticReleaseConfig.cjs +0 -33
- package/cjs/semanticReleaseConfig.cjs.map +0 -1
- package/cjs/semanticReleaseConfig.d.ts +0 -4
- package/cjs/semanticReleaseConfig.d.ts.map +0 -1
- package/cjs/semanticReleaseConfigDotnet-wrapper.mjs +0 -7
- package/cjs/semanticReleaseConfigDotnet.cjs +0 -112
- package/cjs/semanticReleaseConfigDotnet.cjs.map +0 -1
- package/cjs/semanticReleaseConfigDotnet.d.ts +0 -51
- package/cjs/semanticReleaseConfigDotnet.d.ts.map +0 -1
- package/cjs/setupGitPluginSpec-wrapper.mjs +0 -6
- package/cjs/setupGitPluginSpec.cjs +0 -67
- package/cjs/setupGitPluginSpec.cjs.map +0 -1
- package/cjs/setupGitPluginSpec.d.ts +0 -19
- package/cjs/setupGitPluginSpec.d.ts.map +0 -1
- package/src/dotnet/createDummyNupkg.ts +0 -30
- package/src/dotnet/dotnetGHPR.ts +0 -232
- package/src/dotnet/dotnetGLPR.ts +0 -46
- package/src/dotnet/dotnetHelpers.ts +0 -184
- package/src/envUtils.ts +0 -36
- package/src/findStaticConfig.ts +0 -31
- package/static/.releaserc.yml +0 -35
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import type { Increment } from '../GracefulRecursion.js';
|
|
2
|
+
import type { Integer } from '../miscTypes.js';
|
|
3
|
+
import type { FunctionLike } from './FunctionLike.js';
|
|
4
|
+
import { getPrototypeOf } from './getPrototypeOf.js';
|
|
5
|
+
import type { PropertyDescriptorMap } from './PropertyDescriptorMap.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The `[[Prototype]]` (i.e. `__proto__`) of any base class.
|
|
9
|
+
* @since 3.0.0
|
|
10
|
+
*/
|
|
11
|
+
export type BaseClassProto = (() => object) & {
|
|
12
|
+
/** @example BaseClass.__proto__.__proto__.toString() === '[object Object]' */
|
|
13
|
+
['__proto__']: ObjectConstructor['prototype'] & {
|
|
14
|
+
['__proto__']: null;
|
|
15
|
+
constructor: ObjectConstructor;
|
|
16
|
+
};
|
|
17
|
+
constructor: IBaseClass;
|
|
18
|
+
length: 0;
|
|
19
|
+
name: '';
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The `[[Prototype]]` of all base classes.
|
|
24
|
+
* @since 3.0.0
|
|
25
|
+
*/
|
|
26
|
+
export const baseClassProto: BaseClassProto = getPrototypeOf(Object as BaseClass<ObjectConstructor>);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* [INTERNAL]
|
|
30
|
+
* An interface representing for attaching base class properties to a class type.
|
|
31
|
+
* This kept separate from {@link BaseClass} so it can be used by {@link BaseClassProto}.
|
|
32
|
+
* @since 3.0.0
|
|
33
|
+
*/
|
|
34
|
+
interface IBaseClass {
|
|
35
|
+
/**
|
|
36
|
+
* Readable for compatibility reasons, but invisible and non-enumerable in Node.js runtime.
|
|
37
|
+
* @example BaseClass.__proto__.toString() === 'function () { [native code] }'
|
|
38
|
+
*/
|
|
39
|
+
['__proto__']: BaseClassProto;
|
|
40
|
+
|
|
41
|
+
constructor: FunctionConstructor & { name: 'Function' };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Type a class type as a base class.
|
|
46
|
+
* Note: is `Class & ...`
|
|
47
|
+
* @since 3.0.0
|
|
48
|
+
*/
|
|
49
|
+
export type BaseClass<Class extends ConstructorConstraint<Class>>
|
|
50
|
+
= IClass<Class> & IBaseClass;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A type representing any unknown constructor.
|
|
54
|
+
* @since 3.0.0
|
|
55
|
+
*/
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
|
+
export type Constructor_Unknown = abstract new (...args: any[]) => any;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The constraint for constructor types.
|
|
61
|
+
* This is intended for generic type constraints.
|
|
62
|
+
* For conditional return types, use `T extends Constructor<T>` instead.
|
|
63
|
+
* @template T Any newable constructor type
|
|
64
|
+
* @since 3.0.0
|
|
65
|
+
*/
|
|
66
|
+
export type ConstructorConstraint<T extends abstract new (...args: ConstructorParameters<T>) => InstanceType<T>> = abstract new (...arguments_: ConstructorParameters<T>) => InstanceType<T>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* {@link T} is a class constructor or unknown constructor. Else, `never`.
|
|
70
|
+
*
|
|
71
|
+
* Consider using {@link ClassLike} where walking the inheritance chain is necessary.
|
|
72
|
+
* @template [T=Constructor_Unknown]
|
|
73
|
+
* @since 3.0.0
|
|
74
|
+
*/
|
|
75
|
+
export type ConstructorLike<T = Constructor_Unknown>
|
|
76
|
+
= T extends Constructor_Unknown
|
|
77
|
+
? T extends ConstructorConstraint<T>
|
|
78
|
+
? T & ConstructorConstraint<T>
|
|
79
|
+
: T & Constructor_Unknown
|
|
80
|
+
: never;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* A type representing unknown {@link ClassLike} types.
|
|
84
|
+
* @since 3.0.0
|
|
85
|
+
*/
|
|
86
|
+
export type ClassLike_Unknown
|
|
87
|
+
= IClass<
|
|
88
|
+
Constructor_Unknown
|
|
89
|
+
& WithProto<SuperClassLike | BaseClassProto>
|
|
90
|
+
>;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* A subset of {@link ProtoOrSuperClass} suitable for a class's `[[Prototype]]`
|
|
94
|
+
* @since 3.0.0
|
|
95
|
+
*/
|
|
96
|
+
export type SuperClassLike = BaseClass<Constructor_Unknown> | ClassLike_Unknown;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* A terrible type. Use it if you must, but prefer other types when possible.
|
|
100
|
+
*
|
|
101
|
+
* Covers most SuperClass/Prototype types.
|
|
102
|
+
* A class that does not extend another class will satisfy {@link BaseClass}.
|
|
103
|
+
*
|
|
104
|
+
* If a type extends {@link ProtoOrSuperClass} and is `null`, you cannot get the
|
|
105
|
+
* type's keys. See {@link ./OwnKeyOf.ts}.
|
|
106
|
+
* @template [T=ReturnType<typeof Reflect.getPrototypeOf>] `null` or an `object`-like type.
|
|
107
|
+
* @since 3.0.0
|
|
108
|
+
*/
|
|
109
|
+
export type ProtoOrSuperClass<T extends object | null = ReturnType<typeof Reflect.getPrototypeOf>>
|
|
110
|
+
= T extends null ? null
|
|
111
|
+
: T extends object
|
|
112
|
+
? T extends ConstructorLike<T>
|
|
113
|
+
? T extends ClassLike<T & WithProto<SuperClassLike | BaseClassProto>>
|
|
114
|
+
? T extends BaseClass<T> ? ClassLike<BaseClass<T>>
|
|
115
|
+
: ClassLike<T>
|
|
116
|
+
: T extends BaseClass<T>
|
|
117
|
+
? BaseClass<T>
|
|
118
|
+
: ConstructorLike<T>
|
|
119
|
+
: T extends FunctionLike<infer FunctionConstraint>
|
|
120
|
+
? T extends FunctionConstraint
|
|
121
|
+
? FunctionLike<T>
|
|
122
|
+
: T & FunctionLike<FunctionConstraint>
|
|
123
|
+
: T extends object
|
|
124
|
+
? T & object
|
|
125
|
+
: never
|
|
126
|
+
: never;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain prototype chain} of any `object`-like type.
|
|
130
|
+
* Not to be confused with the _instance_ `.prototype` chain!
|
|
131
|
+
* ```
|
|
132
|
+
* > util.isDeepStrictEqual(Object.getOwnPropertyDescriptors({}.__proto__), Object.getOwnPropertyDescriptors(Object.prototype))
|
|
133
|
+
* true
|
|
134
|
+
* ```
|
|
135
|
+
* @template Object0 Any type with its `[[Prototype]]` attached as a `__proto__` property. The type of `__proto__` must extend {@link ProtoOrSuperClass}.
|
|
136
|
+
* @template [Limit=16]
|
|
137
|
+
* The maximum depth of recursion.
|
|
138
|
+
* Affects the maximum length of the returned type.\
|
|
139
|
+
* CAUTION: Larger values will severely degrade performance.
|
|
140
|
+
* 50 or more will trigger infinite-or-near-infinite-recursion errors.
|
|
141
|
+
* @template [CurrentLevel=0] (INTERNAL) The current depth of the prototype chain.
|
|
142
|
+
* @since 3.0.0
|
|
143
|
+
*/
|
|
144
|
+
export type ProtoChainOfObject<
|
|
145
|
+
Object0 extends WithProto<ProtoOrSuperClass>,
|
|
146
|
+
Limit extends Integer<number> = 16,
|
|
147
|
+
CurrentLevel extends Integer<number> = 0,
|
|
148
|
+
> = PropertyDescriptorMap<Object0['__proto__']> extends PropertyDescriptorMap<ObjectConstructor['prototype']>
|
|
149
|
+
? [Object0]
|
|
150
|
+
: Object0['__proto__'] extends WithProto<ProtoOrSuperClass>
|
|
151
|
+
? CurrentLevel extends Limit ? [Object0]
|
|
152
|
+
: [
|
|
153
|
+
Object0,
|
|
154
|
+
...ProtoChainOfObject<Object0['__proto__'], Limit, Increment<CurrentLevel>>,
|
|
155
|
+
]
|
|
156
|
+
: never;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain prototype chain} of an object (particularly, a class).
|
|
160
|
+
* @template Class Any type with its `[[Prototype]]` attached as a `__proto__` property.
|
|
161
|
+
* The type of `__proto__` must extend {@link SuperClassLike} or {@link BaseClassProto}.
|
|
162
|
+
* @template [Limit=16]
|
|
163
|
+
* The maximum depth of recursion.
|
|
164
|
+
* Affects the maximum length of the returned type.\
|
|
165
|
+
* CAUTION: Larger values will severely degrade performance.
|
|
166
|
+
* 50 or more will trigger infinite-or-near-infinite-recursion errors.
|
|
167
|
+
* @template [CurrentLevel=0] (INTERNAL) The current depth of the prototype chain.
|
|
168
|
+
* @since 3.0.0
|
|
169
|
+
*/
|
|
170
|
+
export type ProtoChainOfClass<
|
|
171
|
+
Class extends WithProto<SuperClassLike | BaseClassProto>,
|
|
172
|
+
Limit extends Integer<number> = 16,
|
|
173
|
+
CurrentLevel extends Integer<number> = 0,
|
|
174
|
+
> = Class['__proto__'] extends BaseClassProto ? [Class]
|
|
175
|
+
: Class['__proto__'] extends SuperClassLike
|
|
176
|
+
? CurrentLevel extends Limit ? [Class]
|
|
177
|
+
: [
|
|
178
|
+
Class,
|
|
179
|
+
...ProtoChainOfClass<Class['__proto__'], Limit, Increment<CurrentLevel>>,
|
|
180
|
+
]
|
|
181
|
+
: never;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain prototype chain} of a class instance.
|
|
185
|
+
* @template Class A constructor type with its `[[Prototype]]` attached as a `__proto__` property.
|
|
186
|
+
* @template [Limit=16]
|
|
187
|
+
* The maximum depth of recursion.
|
|
188
|
+
* Affects the maximum length of the returned type.\
|
|
189
|
+
* CAUTION: Larger values will severely degrade performance.
|
|
190
|
+
* 50 or more will trigger infinite-or-near-infinite-recursion errors.
|
|
191
|
+
* @template [CurrentLevel=0] (INTERNAL) The current depth of the prototype chain.
|
|
192
|
+
* @since 3.0.0
|
|
193
|
+
*/
|
|
194
|
+
export type ProtoChainOfClassInstance<
|
|
195
|
+
Class extends ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>,
|
|
196
|
+
Limit extends Integer<number> = 16,
|
|
197
|
+
CurrentLevel extends Integer<number> = 0,
|
|
198
|
+
> = Class['__proto__'] extends BaseClassProto ? [InstanceType<Class>]
|
|
199
|
+
: Class['__proto__'] extends SuperClassLike
|
|
200
|
+
? CurrentLevel extends Limit ? [InstanceType<Class>]
|
|
201
|
+
: [
|
|
202
|
+
InstanceType<Class>,
|
|
203
|
+
...ProtoChainOfClassInstance<Class['__proto__'], Limit, Increment<CurrentLevel>>,
|
|
204
|
+
]
|
|
205
|
+
: never;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Augment a class type to expose properties not exposed by TypeScript by default.
|
|
209
|
+
* Note: is `Class & ...`
|
|
210
|
+
* @template Class The typeof any class. If the type is unknown, wrap it with {@link ConstructorConstraint}.
|
|
211
|
+
* @since 3.0.0
|
|
212
|
+
*/
|
|
213
|
+
// defined as `type` because interfaces cannot extend their generic parameters
|
|
214
|
+
export type IClass<Class extends ConstructorConstraint<Class>>
|
|
215
|
+
= Class
|
|
216
|
+
& {
|
|
217
|
+
prototype: InstanceType<Class>;
|
|
218
|
+
name: ConstructorConstraint<Class>['name'];
|
|
219
|
+
length: ConstructorConstraint<Class>['length'];
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* A more fleshed-out Class type.
|
|
224
|
+
*
|
|
225
|
+
* Note: is `Class & ...`
|
|
226
|
+
*
|
|
227
|
+
* In addition to the Constructor constraint, this type...
|
|
228
|
+
* - Sets the type of the immediate superclass.
|
|
229
|
+
* - Sets `prototype` to {@link InstanceType}
|
|
230
|
+
* @template Class The `typeof MyClass`. If this class extends a class, pass `typeof MySuperClass` to the generic argument {@link Class}.
|
|
231
|
+
* @example
|
|
232
|
+
* type Class_MyClass = ClassLike<typeof MyClass & WithProto<BaseClass<typeof MyBaseClass>>;
|
|
233
|
+
* @since 3.0.0
|
|
234
|
+
*/
|
|
235
|
+
export type ClassLike<
|
|
236
|
+
Class extends ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>,
|
|
237
|
+
> = Class extends BaseClass<Class> ? Class
|
|
238
|
+
: Class['__proto__'] extends BaseClassProto ? BaseClass<Class>
|
|
239
|
+
: Class['__proto__'] extends ConstructorLike<Class['__proto__']>
|
|
240
|
+
? IClass<Class> & WithProto<ConstructorLike<Class['__proto__']>>
|
|
241
|
+
// Here, __proto__ is retained via Class
|
|
242
|
+
: IClass<Class>;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* If {@link T} is a class or constructor, {@link InstanceType}<{@link T}>. Else, {@link T}.
|
|
246
|
+
* @template T `null` or any `object`-like type.
|
|
247
|
+
* @since 3.0.0
|
|
248
|
+
*/
|
|
249
|
+
export type InstanceTypeOrSelf<T extends object | null> = T extends ConstructorLike
|
|
250
|
+
? T extends ConstructorLike<T>
|
|
251
|
+
? InstanceType<T>
|
|
252
|
+
: T
|
|
253
|
+
: T;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Interface for attaching a `__proto__` to an object e.g. `T0 & WithProto<T1>`
|
|
257
|
+
* @template __proto__ the type of the an object's `[[Prototype]]`.
|
|
258
|
+
* @since 3.0.0
|
|
259
|
+
*/
|
|
260
|
+
export interface WithProto<__proto__ extends ProtoOrSuperClass> {
|
|
261
|
+
['__proto__']: __proto__;
|
|
262
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A very jank function to determine if an object can be the target of Reflect.construct.
|
|
3
|
+
* Unfortunately, many functions have a constructor in their prototype. These
|
|
4
|
+
* functions are treated like classes due to JavaScript's poor distinction between
|
|
5
|
+
* classes and functions.\
|
|
6
|
+
* Typescript can enforce "new" keyword usage, but overriding the type
|
|
7
|
+
* allows you to `new isConstructor()` despite this function not intended to be
|
|
8
|
+
* used with the `new` keyword.
|
|
9
|
+
* #### NOTE: Only works when targeting ES6/ES2015 or later.
|
|
10
|
+
* > If your project or a dependent project is compiled to < ES6, this function will always return `false`; classes and constructors were introduced in ES6/ES2015.
|
|
11
|
+
* @param obj Anything.
|
|
12
|
+
* @returns `true` if the obj is a constructor. Else, `false`.
|
|
13
|
+
* @since 3.0.0
|
|
14
|
+
* @see https://stackoverflow.com/a/49510834
|
|
15
|
+
*/
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
export function isConstructor(obj: unknown): obj is abstract new (...args: any[]) => any {
|
|
18
|
+
// Method 0 - filter
|
|
19
|
+
if (typeof obj !== 'function')
|
|
20
|
+
return false;
|
|
21
|
+
|
|
22
|
+
// Method 1
|
|
23
|
+
// statically-defined class
|
|
24
|
+
if (/^class\s/.test(obj.toString()))
|
|
25
|
+
return true;
|
|
26
|
+
|
|
27
|
+
/* Method 2
|
|
28
|
+
* > class class_ {}; function func(){}
|
|
29
|
+
* undefined
|
|
30
|
+
* > class_.prototype.constructor.name === class_.name
|
|
31
|
+
* true
|
|
32
|
+
* > func.prototype?.constructor?.name === func.name
|
|
33
|
+
* false
|
|
34
|
+
* typeof String.prototype ==='object'
|
|
35
|
+
* > true
|
|
36
|
+
* typeof Function.prototype === 'object';
|
|
37
|
+
* > false
|
|
38
|
+
* typeof Function.prototype
|
|
39
|
+
* > 'function'
|
|
40
|
+
*/
|
|
41
|
+
const prototype: unknown = obj.prototype;
|
|
42
|
+
if ((typeof prototype === 'object' || typeof prototype === 'function')
|
|
43
|
+
&& prototype !== null
|
|
44
|
+
&& 'constructor' in prototype
|
|
45
|
+
&& typeof prototype.constructor === 'function') {
|
|
46
|
+
const _ctor = prototype.constructor as (new (...arguments_: unknown[]) => unknown);
|
|
47
|
+
const _name = Reflect.getOwnPropertyDescriptor(
|
|
48
|
+
_ctor,
|
|
49
|
+
'name',
|
|
50
|
+
);
|
|
51
|
+
// short-circuit if `obj.prototype.constructor` is a function, but not a constructor. Return false.
|
|
52
|
+
return (
|
|
53
|
+
_ctor === obj
|
|
54
|
+
&& _name?.writable === false
|
|
55
|
+
&& _name.enumerable === false
|
|
56
|
+
&& _name.configurable === true
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Short-circuit
|
|
61
|
+
// Method 3 catches exceptions when !isConstructor. When debugging, that's annoying.
|
|
62
|
+
return false;
|
|
63
|
+
|
|
64
|
+
// Method 3
|
|
65
|
+
// isConstructable (See https://stackoverflow.com/a/49510834)
|
|
66
|
+
// try {
|
|
67
|
+
// // @ts-expect-error ts(2351): Type 'Function' has no construct signatures.
|
|
68
|
+
// new new Proxy(obj, { construct: () => ({}) })()
|
|
69
|
+
// return true
|
|
70
|
+
// }
|
|
71
|
+
// catch {
|
|
72
|
+
// return false
|
|
73
|
+
// }
|
|
74
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GetterDescriptor } from './GetterDescriptor.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A function for inferring a {@link TypedPropertyDescriptor} is a {@link GetterDescriptor}
|
|
5
|
+
* @param propertyDescriptor The {@link TypedPropertyDescriptor} to inspect.
|
|
6
|
+
* @returns `true` if {@link propertyDescriptor} describes a getter. Else, `false.
|
|
7
|
+
* @since 3.0.0
|
|
8
|
+
*/
|
|
9
|
+
export function isGetterDescriptor<T>(propertyDescriptor: TypedPropertyDescriptor<T>): propertyDescriptor is GetterDescriptor<T> {
|
|
10
|
+
return typeof propertyDescriptor.get === 'function';
|
|
11
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { InstanceOrStatic } from '../miscTypes.js';
|
|
2
|
+
import { filterForGetters } from './filterForGetters.js';
|
|
3
|
+
import { getOwnPropertyDescriptors } from './getOwnPropertyDescriptors.js';
|
|
4
|
+
import type {
|
|
5
|
+
BaseClassProto,
|
|
6
|
+
ClassLike,
|
|
7
|
+
ConstructorConstraint,
|
|
8
|
+
InstanceTypeOrSelf,
|
|
9
|
+
SuperClassLike,
|
|
10
|
+
WithProto,
|
|
11
|
+
} from './inheritance.js';
|
|
12
|
+
import type { InstancePropertyDescriptorMap } from './InstancePropertyDescriptorMap.js';
|
|
13
|
+
import type { OwnPropertyDescriptorMap } from './OwnPropertyDescriptorMap.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Description placeholder
|
|
17
|
+
* @template {ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>} Class
|
|
18
|
+
* @template {InstanceOrStatic} _InstanceOrStatic
|
|
19
|
+
* @since 3.0.0
|
|
20
|
+
*/
|
|
21
|
+
type OwnGetters<
|
|
22
|
+
Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>,
|
|
23
|
+
_InstanceOrStatic extends InstanceOrStatic,
|
|
24
|
+
>
|
|
25
|
+
= [_InstanceOrStatic] extends ['Instance']
|
|
26
|
+
? Exclude<
|
|
27
|
+
(Class['__proto__'] extends BaseClassProto ? null : InstanceTypeOrSelf<Class['__proto__']>) extends null
|
|
28
|
+
? keyof InstanceType<Class>
|
|
29
|
+
: Exclude<
|
|
30
|
+
keyof InstanceType<Class>,
|
|
31
|
+
keyof (Class['__proto__'] extends BaseClassProto ? null : InstanceTypeOrSelf<Class['__proto__']>)
|
|
32
|
+
>,
|
|
33
|
+
'__proto__'
|
|
34
|
+
>[]
|
|
35
|
+
: [_InstanceOrStatic] extends ['Static']
|
|
36
|
+
? Exclude<
|
|
37
|
+
Class['__proto__'] extends null ? keyof Class : Exclude<keyof Class, keyof Class['__proto__']>,
|
|
38
|
+
'__proto__'
|
|
39
|
+
>[]
|
|
40
|
+
: never;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* # !WARNING!
|
|
44
|
+
* > If you don't specify the Class's SuperClass (or `BaseClassProto`) via WithProto, the return type will wrongly include inherited property names! This is a design limitation of TypeScript.
|
|
45
|
+
*
|
|
46
|
+
* Returns the names of the instantiated (or static), noninherited getters derived from the
|
|
47
|
+
* given prototype or prototype of the given object.
|
|
48
|
+
* @template {ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>} Class
|
|
49
|
+
* @template {InstanceOrStatic} _InstanceOrStatic 'Instance' or 'Static'. Determines the return type.
|
|
50
|
+
* @param classDefinition Any class cast to ClassLike
|
|
51
|
+
* @param instanceOrStatic 'Instance' or 'Static'. Determines the return type.
|
|
52
|
+
* @since 3.0.0
|
|
53
|
+
* @returns
|
|
54
|
+
* An array of names of getters that were not inherited from a parent class. If {@link classDefinition} is a class instance, the names of instanced getters are returned. Otherwise, the names of static getters are returned;
|
|
55
|
+
*/
|
|
56
|
+
export function listOwnGetters<
|
|
57
|
+
Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>,
|
|
58
|
+
_InstanceOrStatic extends InstanceOrStatic,
|
|
59
|
+
>(
|
|
60
|
+
classDefinition: Class,
|
|
61
|
+
instanceOrStatic: Extract<_InstanceOrStatic, InstanceOrStatic>,
|
|
62
|
+
): OwnGetters<Class, _InstanceOrStatic> {
|
|
63
|
+
if (instanceOrStatic === 'Instance') {
|
|
64
|
+
const descriptorMap: InstancePropertyDescriptorMap<Class> = getOwnPropertyDescriptors(classDefinition, instanceOrStatic as 'Instance');
|
|
65
|
+
const getterDescriptorMap = filterForGetters(descriptorMap);
|
|
66
|
+
const keyArray = Reflect.ownKeys(getterDescriptorMap) as (keyof typeof getterDescriptorMap)[];
|
|
67
|
+
return keyArray as [typeof instanceOrStatic & 'Instance'] extends ['Instance'] ? typeof keyArray : never;
|
|
68
|
+
}
|
|
69
|
+
else if (instanceOrStatic === 'Static') {
|
|
70
|
+
const descriptorMap: OwnPropertyDescriptorMap<Class> = getOwnPropertyDescriptors(classDefinition, instanceOrStatic as 'Static');
|
|
71
|
+
const getterDescriptorMap = filterForGetters(descriptorMap);
|
|
72
|
+
const keyArray = Reflect.ownKeys(getterDescriptorMap) as (keyof typeof getterDescriptorMap)[];
|
|
73
|
+
return keyArray as [_InstanceOrStatic] extends ['Instance']
|
|
74
|
+
? never
|
|
75
|
+
: [_InstanceOrStatic] extends ['Static']
|
|
76
|
+
? typeof keyArray
|
|
77
|
+
: never;
|
|
78
|
+
}
|
|
79
|
+
else throw new TypeError('Argument `instanceOrStatic` must be "Instance" or "Static".');
|
|
80
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type * from './reflection/FunctionLike.js';
|
|
2
|
+
export type * from './reflection/GetterDescriptor.js';
|
|
3
|
+
export type * from './reflection/InstancePropertyDescriptorMap.js';
|
|
4
|
+
export type * from './reflection/InstanceTypeOrSelfPropertyDescriptorMap.js';
|
|
5
|
+
export type * from './reflection/OwnGetterDescriptorMap.js';
|
|
6
|
+
export type * from './reflection/OwnKeyOf.js';
|
|
7
|
+
export type * from './reflection/OwnPropertyDescriptorMap.js';
|
|
8
|
+
export type * from './reflection/PropertyDescriptorMap.js';
|
|
9
|
+
|
|
10
|
+
export * from './reflection/filterForGetters.js';
|
|
11
|
+
export * from './reflection/getOwnPropertyDescriptors.js';
|
|
12
|
+
export * from './reflection/getOwnPropertyDescriptorsRecursively.js';
|
|
13
|
+
export * from './reflection/getPrototypeChainOf.js';
|
|
14
|
+
export * from './reflection/getPrototypeOf.js';
|
|
15
|
+
export * from './reflection/inheritance.js';
|
|
16
|
+
export * from './reflection/isConstructor.js';
|
|
17
|
+
export * from './reflection/isGetterDescriptor.js';
|
|
18
|
+
export * from './reflection/listOwnGetters.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commitlintConfig.cjs","sources":["../src/commitlintConfig.ts"],"sourcesContent":null,"names":[],"mappings":";;AAAA;AACA,MAAM,QAAQ,GAAG,CAAC;AACb,MAAC,gBAAgB,GAAG;AACzB,EAAE,OAAO,EAAE,CAAC,iCAAiC,CAAC;AAC9C,EAAE,KAAK,EAAE;AACT,IAAI,sBAAsB,EAAE,CAAC,QAAQ,CAAC;AACtC,IAAI,wBAAwB,EAAE,CAAC,QAAQ,CAAC;AACxC,IAAI,mBAAmB,EAAE,CAAC,QAAQ;AAClC;AACA;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commitlintConfig.d.ts","sourceRoot":"","sources":["../src/commitlintConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI7E,QAAA,MAAM,gBAAgB,EAAE,UAOvB,CAAC;AAGF,eAAe,gBAAgB,CAAC"}
|
package/cjs/debug.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const debug = require('debug');
|
|
4
|
-
const _interopDefault = e => e && e.__esModule ? e : {
|
|
5
|
-
default: e
|
|
6
|
-
};
|
|
7
|
-
const debug__default = /*#__PURE__*/_interopDefault(debug);
|
|
8
|
-
const _debug = debug__default.default('@halospv3/hce.shared-config');
|
|
9
|
-
if (process.argv.some(v => v.includes('--debug')) || debug__default.default.enabled('*')) {
|
|
10
|
-
debug__default.default.enable(_debug.namespace);
|
|
11
|
-
}
|
|
12
|
-
module.exports = _debug;
|
|
13
|
-
//# sourceMappingURL=debug.cjs.map
|
package/cjs/debug.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debug.cjs","sources":["../src/debug.ts"],"sourcesContent":null,"names":["debug"],"mappings":";;;;;;;;AACK,MAAC,MAAM,GAAGA,sBAAK,CAAC,6BAA6B;AAClD,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,IAAIA,sBAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;AACzE,EAAEA,sBAAK,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;AAChC;;;;"}
|
package/cjs/debug.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
7
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
-
const node_child_process = require('node:child_process');
|
|
9
|
-
const MSBuildProjectProperties = require('./MSBuildProjectProperties.cjs');
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* All pre-defined properties of {@link MSBuildProjectProperties} except FullPath
|
|
13
|
-
*/
|
|
14
|
-
const MSBuildProjectPreDefinedProperties = Object.keys(new MSBuildProjectProperties.MSBuildProjectProperties('', false)).filter(p => p !== 'FullPath');
|
|
15
|
-
/** @todo Experimental and may be removed in a later release.
|
|
16
|
-
* A cache for your evaluated MSBuild Projects.
|
|
17
|
-
*/
|
|
18
|
-
const MSBuildEvaluatedProjects = [];
|
|
19
|
-
class MSBuildProject {
|
|
20
|
-
Properties;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
* @param fullPath The full path of the .NET MSBuild project file.
|
|
25
|
-
* @param customProperties MSBuild properties to evaluate in addition to those pre-defined in {@link MSBuildProjectProperties}
|
|
26
|
-
*/
|
|
27
|
-
constructor(fullPath, customProperties) {
|
|
28
|
-
// super();
|
|
29
|
-
this.Properties = MSBuildProject.evaluateProperties(fullPath, customProperties ?? []);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
34
|
-
* `dotnet msbuild src -getProperty:TargetFramework -getProperty:TargetFrameworks -getProperty:RuntimeIdentifiers -getProperty:IsTrimmable`
|
|
35
|
-
*
|
|
36
|
-
* ...produces...
|
|
37
|
-
*
|
|
38
|
-
* ```json
|
|
39
|
-
* {
|
|
40
|
-
* "Properties": {
|
|
41
|
-
* "TargetFramework": "net6.0",
|
|
42
|
-
* "TargetFrameworks": "",
|
|
43
|
-
* "RuntimeIdentifiers": "win7-x64;win7-x86;win-arm64;linux-x64;linux-arm64",
|
|
44
|
-
* "IsTrimmable": "true",
|
|
45
|
-
* }
|
|
46
|
-
* }
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* ...which can can be parsed like...
|
|
50
|
-
* ```js
|
|
51
|
-
* var ridArray = JSON.parse(out).Properties.RuntimeIdentifiers.split(';');
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
static evaluateProperties(fullPath, properties) {
|
|
55
|
-
const evaluatedProps = new MSBuildProjectProperties.MSBuildProjectProperties(fullPath);
|
|
56
|
-
|
|
57
|
-
// if a default prop isn't in properties, add it
|
|
58
|
-
const defaultProps = MSBuildProjectPreDefinedProperties;
|
|
59
|
-
for (const defaultProp of defaultProps) {
|
|
60
|
-
if (!properties.includes(defaultProp)) properties.push(defaultProp);
|
|
61
|
-
}
|
|
62
|
-
const getPropArgs = properties.map(propName => `-getProperty:${propName}`);
|
|
63
|
-
// should return a single value OR string-encoded JSON object with 'Properties' object-type property.
|
|
64
|
-
const out = node_child_process.execFileSync('dotnet', ['msbuild', evaluatedProps.FullPath, ...getPropArgs], {
|
|
65
|
-
encoding: 'utf8',
|
|
66
|
-
stdio: 'pipe'
|
|
67
|
-
}).trim();
|
|
68
|
-
if (out.startsWith('MSBUILD : error')) throw new Error(out);
|
|
69
|
-
let props;
|
|
70
|
-
if (out.startsWith('{')) {
|
|
71
|
-
const obj = JSON.parse(out);
|
|
72
|
-
if ("Properties" in obj && typeof obj.Properties === 'object' && obj.Properties !== null) props = obj.Properties;else throw new Error('When evaluating properties with MSBuild, "Properties" could not be found in the deserialized JSON object...\n' + JSON.stringify(obj));
|
|
73
|
-
} else {
|
|
74
|
-
props = {
|
|
75
|
-
[properties[0]]: out.trim()
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
return _objectSpread(_objectSpread({}, evaluatedProps), props);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
exports.MSBuildEvaluatedProjects = MSBuildEvaluatedProjects;
|
|
82
|
-
exports.MSBuildProject = MSBuildProject;
|
|
83
|
-
exports.MSBuildProjectPreDefinedProperties = MSBuildProjectPreDefinedProperties;
|
|
84
|
-
//# sourceMappingURL=MSBuildProject.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MSBuildProject.cjs","sources":["../../src/dotnet/MSBuildProject.ts"],"sourcesContent":null,"names":["MSBuildProjectProperties","execFileSync"],"mappings":";;;;;AAGA;AACA;AACA;AACY,MAAC,kCAAkC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAIA,iDAAwB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,UAAU;AACnI;AACA;AACA;AACY,MAAC,wBAAwB,GAAG;AACjC,MAAM,cAAc,CAAC;AAC5B,EAAE,UAAU;;AAEZ;AACA;AACA;AACA;AACA;AACA,EAAE,WAAW,CAAC,QAAQ,EAAE,gBAAgB,EAAE;AAC1C;AACA,IAAI,IAAI,CAAC,UAAU,GAAG,cAAc,CAAC,kBAAkB,CAAC,QAAQ,EAAE,gBAAgB,IAAI,EAAE,CAAC;AACzF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,OAAO,kBAAkB,CAAC,QAAQ,EAAE,UAAU,EAAE;AAClD,IAAI,MAAM,cAAc,GAAG,IAAIA,iDAAwB,CAAC,QAAQ,CAAC;;AAEjE;AACA,IAAI,MAAM,YAAY,GAAG,kCAAkC;AAC3D,IAAI,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;AAC5C,MAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC;AACzE;AACA,IAAI,MAAM,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC9E;AACA,IAAI,MAAM,GAAG,GAAGC,+BAAY,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,cAAc,CAAC,QAAQ,EAAE,GAAG,WAAW,CAAC,EAAE;AAC7F,MAAM,QAAQ,EAAE,MAAM;AACtB,MAAM,KAAK,EAAE;AACb,KAAK,CAAC,CAAC,IAAI,EAAE;AACb,IAAI,IAAI,GAAG,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC;AAC/D,IAAI,IAAI,KAAK;AACb,IAAI,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;AAC7B,MAAM,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;AACjC,MAAM,IAAI,YAAY,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU,KAAK,IAAI,EAAE,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,KAAK,MAAM,IAAI,KAAK,CAAC,+GAA+G,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AAClR,KAAK,MAAM;AACX,MAAM,KAAK,GAAG;AACd,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI;AACjC,OAAO;AACP;AACA,IAAI,OAAO;AACX,MAAM,GAAG,cAAc;AACvB,MAAM,GAAG;AACT,KAAK;AACL;AACA;;;;;;"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { MSBuildProjectProperties } from './MSBuildProjectProperties.js';
|
|
2
|
-
/**
|
|
3
|
-
* All pre-defined properties of {@link MSBuildProjectProperties} except FullPath
|
|
4
|
-
*/
|
|
5
|
-
export declare const MSBuildProjectPreDefinedProperties: string[];
|
|
6
|
-
/** @todo Experimental and may be removed in a later release.
|
|
7
|
-
* A cache for your evaluated MSBuild Projects.
|
|
8
|
-
*/
|
|
9
|
-
export declare const MSBuildEvaluatedProjects: MSBuildProject[];
|
|
10
|
-
export declare class MSBuildProject {
|
|
11
|
-
Properties: MSBuildProjectProperties;
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @param fullPath The full path of the .NET MSBuild project file.
|
|
15
|
-
* @param customProperties MSBuild properties to evaluate in addition to those pre-defined in {@link MSBuildProjectProperties}
|
|
16
|
-
*/
|
|
17
|
-
constructor(fullPath: string, customProperties?: string[]);
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* `dotnet msbuild src -getProperty:TargetFramework -getProperty:TargetFrameworks -getProperty:RuntimeIdentifiers -getProperty:IsTrimmable`
|
|
21
|
-
*
|
|
22
|
-
* ...produces...
|
|
23
|
-
*
|
|
24
|
-
* ```json
|
|
25
|
-
* {
|
|
26
|
-
* "Properties": {
|
|
27
|
-
* "TargetFramework": "net6.0",
|
|
28
|
-
* "TargetFrameworks": "",
|
|
29
|
-
* "RuntimeIdentifiers": "win7-x64;win7-x86;win-arm64;linux-x64;linux-arm64",
|
|
30
|
-
* "IsTrimmable": "true",
|
|
31
|
-
* }
|
|
32
|
-
* }
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* ...which can can be parsed like...
|
|
36
|
-
* ```js
|
|
37
|
-
* var ridArray = JSON.parse(out).Properties.RuntimeIdentifiers.split(';');
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
static evaluateProperties(fullPath: string, properties: string[]): MSBuildProjectProperties;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=MSBuildProject.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MSBuildProject.d.ts","sourceRoot":"","sources":["../../src/dotnet/MSBuildProject.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE;;GAEG;AACH,eAAO,MAAM,kCAAkC,UAEd,CAAC;AAClC;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,cAAc,EAAO,CAAC;AAE7D,qBAAa,cAAc;IAC1B,UAAU,EAAE,wBAAwB,CAAC;IAErC;;;;OAIG;gBACS,QAAQ,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,EAAE;IAKzD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,wBAAwB;CAiC3F"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const node_fs = require('node:fs');
|
|
4
|
-
const path = require('node:path');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Known properties. Additional properties may be added upon request.
|
|
8
|
-
*/
|
|
9
|
-
class MSBuildProjectProperties {
|
|
10
|
-
FullPath = '';
|
|
11
|
-
TargetFramework = '';
|
|
12
|
-
TargetFrameworks = '';
|
|
13
|
-
RuntimeIdentifier = '';
|
|
14
|
-
RuntimeIdentifiers = '';
|
|
15
|
-
constructor(fullPath, exists = true) {
|
|
16
|
-
this.FullPath = fullPath;
|
|
17
|
-
if (!path.isAbsolute(this.FullPath)) this.FullPath = path.resolve(this.FullPath);
|
|
18
|
-
if (!node_fs.existsSync(this.FullPath) && exists) throw new Error(`Project ${path.basename(this.FullPath)} could not be found at "${this.FullPath}"`);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.MSBuildProjectProperties = MSBuildProjectProperties;
|
|
22
|
-
//# sourceMappingURL=MSBuildProjectProperties.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MSBuildProjectProperties.cjs","sources":["../../src/dotnet/MSBuildProjectProperties.ts"],"sourcesContent":null,"names":["isAbsolute","resolve","existsSync","basename"],"mappings":";;;;;AAGA;AACA;AACA;AACO,MAAM,wBAAwB,CAAC;AACtC,EAAE,QAAQ,GAAG,EAAE;AACf,EAAE,eAAe,GAAG,EAAE;AACtB,EAAE,gBAAgB,GAAG,EAAE;AACvB,EAAE,iBAAiB,GAAG,EAAE;AACxB,EAAE,kBAAkB,GAAG,EAAE;AACzB,EAAE,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE;AACvC,IAAI,IAAI,CAAC,QAAQ,GAAG,QAAQ;AAC5B,IAAI,IAAI,CAACA,eAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,GAAGC,YAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;AAC1E,IAAI,IAAI,CAACC,kBAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,MAAM,EAAE,MAAM,IAAI,KAAK,CAAC,CAAC,QAAQ,EAAEC,aAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,wBAAwB,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC5I;AACA;;;;"}
|