@powerlines/plugin-env 0.15.59 → 0.15.61
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/babel/plugin.cjs +6 -6
- package/dist/babel/plugin.mjs +6 -6
- package/dist/components/docs.cjs +4 -4
- package/dist/components/docs.mjs +4 -4
- package/dist/components/env.cjs +2 -2
- package/dist/components/env.mjs +2 -2
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/helpers/automd-generator.cjs +2 -2
- package/dist/helpers/automd-generator.mjs +2 -2
- package/dist/helpers/index.cjs +1 -1
- package/dist/helpers/index.mjs +1 -1
- package/dist/helpers/load.cjs +4 -4
- package/dist/helpers/load.mjs +4 -4
- package/dist/helpers/persistence.cjs +6 -6
- package/dist/helpers/persistence.mjs +6 -6
- package/dist/helpers/reflect.cjs +4 -4
- package/dist/helpers/reflect.mjs +4 -4
- package/dist/index.cjs +25 -25
- package/dist/index.mjs +25 -25
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/parse-type-definition.cjs +37 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/parse-type-definition.mjs +37 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/to-array.cjs +15 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/to-array.mjs +14 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/get-object-tag.cjs +15 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/get-object-tag.mjs +14 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-buffer.cjs +6 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-buffer.mjs +6 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-object.cjs +19 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-object.mjs +19 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-plain-object.cjs +63 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-plain-object.mjs +63 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-string.cjs +12 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-string.mjs +11 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/type-detect.cjs +15 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/type-detect.mjs +16 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/is-parent-path.cjs +32 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/is-parent-path.mjs +32 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/is-type.cjs +28 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/is-type.mjs +28 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/join-paths.cjs +106 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/join-paths.mjs +106 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/regex.cjs +12 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/regex.mjs +8 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/slash.cjs +15 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/slash.mjs +14 -0
- package/dist/node_modules/.pnpm/c12@3.3.3_magicast@0.5.1/node_modules/c12/dist/index.cjs +1 -1
- package/dist/node_modules/.pnpm/c12@3.3.3_magicast@0.5.1/node_modules/c12/dist/index.mjs +1 -1
- package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.cjs +1 -1
- package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs +1 -1
- package/dist/node_modules/.pnpm/rc9@2.1.2/node_modules/rc9/dist/index.cjs +1 -1
- package/dist/node_modules/.pnpm/rc9@2.1.2/node_modules/rc9/dist/index.mjs +1 -1
- package/dist/packages/powerlines/src/types/config.d.mts +1 -1
- package/package.json +16 -16
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/parse-type-definition.cjs +0 -31
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/parse-type-definition.mjs +0 -31
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/to-array.cjs +0 -8
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/to-array.mjs +0 -7
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/get-object-tag.cjs +0 -6
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/get-object-tag.mjs +0 -5
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/is-buffer.cjs +0 -6
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/is-buffer.mjs +0 -6
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/is-object.cjs +0 -13
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/is-object.mjs +0 -13
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/is-plain-object.cjs +0 -13
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/is-plain-object.mjs +0 -13
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/is-string.cjs +0 -12
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/is-string.mjs +0 -11
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/type-detect.cjs +0 -11
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/type-detect.mjs +0 -12
- package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/is-parent-path.cjs +0 -10
- package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/is-parent-path.mjs +0 -10
- package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/is-type.cjs +0 -13
- package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/is-type.mjs +0 -13
- package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/join-paths.cjs +0 -49
- package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/join-paths.mjs +0 -49
- package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/regex.cjs +0 -9
- package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/regex.mjs +0 -5
- package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/slash.cjs +0 -8
- package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/slash.mjs +0 -7
- /package/dist/node_modules/.pnpm/{@stryke_convert@0.6.32 → @stryke_convert@0.6.34}/node_modules/@stryke/convert/dist/type-checks/src/index.cjs +0 -0
- /package/dist/node_modules/.pnpm/{@stryke_convert@0.6.32 → @stryke_convert@0.6.34}/node_modules/@stryke/convert/dist/type-checks/src/index.mjs +0 -0
- /package/dist/node_modules/.pnpm/{@stryke_convert@0.6.32 → @stryke_convert@0.6.34}/node_modules/@stryke/convert/dist/type-checks/src/is-collection.cjs +0 -0
- /package/dist/node_modules/.pnpm/{@stryke_convert@0.6.32 → @stryke_convert@0.6.34}/node_modules/@stryke/convert/dist/type-checks/src/is-collection.mjs +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { n } from "./node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/parse-type-definition.mjs";
|
|
2
|
-
import { e } from "./node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/to-array.mjs";
|
|
3
|
-
import { t } from "./node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/is-parent-path.mjs";
|
|
4
|
-
import { o } from "./node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/join-paths.mjs";
|
|
5
|
-
import { defu } from "./node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs";
|
|
6
1
|
import { __ΩEnvInterface, __ΩSecretsInterface } from "./types/runtime.mjs";
|
|
7
2
|
import { __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from "./types/plugin.mjs";
|
|
3
|
+
import "./types/index.mjs";
|
|
4
|
+
import { joinPaths } from "./node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/join-paths.mjs";
|
|
5
|
+
import { isParentPath } from "./node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/is-parent-path.mjs";
|
|
8
6
|
import { BaseEnv, BaseSecrets, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from "./helpers/reflect.mjs";
|
|
9
7
|
import { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection } from "./helpers/persistence.mjs";
|
|
10
|
-
import {
|
|
8
|
+
import { createTemplateReflection } from "./helpers/template-helpers.mjs";
|
|
11
9
|
import { formatEnvField, removeEnvPrefix } from "./helpers/source-file-env.mjs";
|
|
10
|
+
import { defu } from "./node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs";
|
|
12
11
|
import { loadEnv, loadEnvFromContext } from "./helpers/load.mjs";
|
|
13
12
|
import { createReflectionResource } from "./helpers/create-reflection-resource.mjs";
|
|
14
|
-
import
|
|
13
|
+
import "./helpers/index.mjs";
|
|
15
14
|
import { env } from "./helpers/automd-generator.mjs";
|
|
16
|
-
import "./babel/index.mjs";
|
|
17
15
|
import { EnvDocs } from "./components/docs.mjs";
|
|
16
|
+
import { EnvBuiltin, EnvTypeDefinition } from "./components/env.mjs";
|
|
18
17
|
import "./components/index.mjs";
|
|
19
|
-
import {
|
|
20
|
-
import "./
|
|
21
|
-
import "./
|
|
22
|
-
import {
|
|
18
|
+
import { envBabelPlugin } from "./babel/plugin.mjs";
|
|
19
|
+
import "./babel/index.mjs";
|
|
20
|
+
import { parseTypeDefinition } from "./node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/parse-type-definition.mjs";
|
|
21
|
+
import { toArray } from "./node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/to-array.mjs";
|
|
23
22
|
import { ReflectionClass, ReflectionKind, stringifyType } from "@powerlines/deepkit/vendor/type";
|
|
23
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
24
|
+
import { ENV_PREFIXES } from "@stryke/env/types";
|
|
25
|
+
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
26
|
+
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
24
27
|
import alloy from "@powerlines/plugin-alloy";
|
|
25
28
|
import automd from "@powerlines/plugin-automd";
|
|
26
29
|
import babel from "@powerlines/plugin-babel";
|
|
27
|
-
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
28
|
-
import { ENV_PREFIXES } from "@stryke/env/types";
|
|
29
30
|
import { existsSync } from "@stryke/fs/exists";
|
|
30
31
|
import { createDirectory } from "@stryke/fs/helpers";
|
|
31
32
|
import { constantCase } from "@stryke/string-format/constant-case";
|
|
32
|
-
import { titleCase } from "@stryke/string-format/title-case";
|
|
33
33
|
|
|
34
34
|
//#region src/index.tsx
|
|
35
35
|
/**
|
|
@@ -50,18 +50,18 @@ const plugin = (options = {}) => {
|
|
|
50
50
|
}),
|
|
51
51
|
transform: { babel: { plugins: [envBabelPlugin] } }
|
|
52
52
|
};
|
|
53
|
-
if (config.env.types) config.env.types =
|
|
53
|
+
if (config.env.types) config.env.types = parseTypeDefinition(config.env.types);
|
|
54
54
|
else {
|
|
55
55
|
this.log(LogLevelLabel.WARN, "The `env.types` configuration parameter was not provided. Please ensure this is expected.");
|
|
56
56
|
const envDefaultTypeDefinition = await getEnvDefaultTypeDefinition(this);
|
|
57
|
-
config.env.types =
|
|
57
|
+
config.env.types = parseTypeDefinition(`${envDefaultTypeDefinition.file}#${envDefaultTypeDefinition.name}`);
|
|
58
58
|
}
|
|
59
|
-
if (config.env.secrets) config.env.secrets =
|
|
59
|
+
if (config.env.secrets) config.env.secrets = parseTypeDefinition(config.env.secrets);
|
|
60
60
|
else {
|
|
61
61
|
const secretsDefaultTypeDefinition = await getSecretsDefaultTypeDefinition(this);
|
|
62
|
-
config.env.secrets =
|
|
62
|
+
config.env.secrets = parseTypeDefinition(`${secretsDefaultTypeDefinition.file}#${secretsDefaultTypeDefinition.name}`);
|
|
63
63
|
}
|
|
64
|
-
config.env.prefix =
|
|
64
|
+
config.env.prefix = toArray(config.env.prefix ?? []).reduce((ret, prefix) => {
|
|
65
65
|
const formattedPrefix = constantCase(prefix);
|
|
66
66
|
if (!ret.includes(formattedPrefix)) ret.push(formattedPrefix);
|
|
67
67
|
return ret;
|
|
@@ -70,7 +70,7 @@ const plugin = (options = {}) => {
|
|
|
70
70
|
"POWERLINES_",
|
|
71
71
|
this.config.framework && this.config.framework !== "powerlines" && `${constantCase(this.config.framework)}_`
|
|
72
72
|
].filter(Boolean));
|
|
73
|
-
config.env.prefix =
|
|
73
|
+
config.env.prefix = toArray(config.env.prefix).reduce((ret, prefix) => {
|
|
74
74
|
if (!ret.includes(prefix.replace(/_$/g, ""))) ret.push(prefix.replace(/_$/g, ""));
|
|
75
75
|
return ret;
|
|
76
76
|
}, []);
|
|
@@ -95,10 +95,10 @@ const plugin = (options = {}) => {
|
|
|
95
95
|
if (existsSync(getEnvTypeReflectionsPath(this, "secrets"))) this.env.types.secrets = await readEnvTypeReflection(this, "secrets");
|
|
96
96
|
if (existsSync(getEnvReflectionsPath(this, "secrets"))) this.env.used.secrets = await readSecretsReflection(this);
|
|
97
97
|
} else {
|
|
98
|
-
this.env.types.env = await reflectEnv(this, this.config.env.types?.file ?
|
|
98
|
+
this.env.types.env = await reflectEnv(this, this.config.env.types?.file ? isParentPath(this.config.env.types?.file, this.workspaceConfig.workspaceRoot) ? this.config.env.types?.file : joinPaths(this.config.projectRoot, this.config.env.types?.file) : void 0, this.config.env.types?.name);
|
|
99
99
|
if (!this.env.types.env) throw new Error("Failed to find the environment configuration type reflection in the context.");
|
|
100
100
|
await writeEnvTypeReflection(this, this.env.types.env, "env");
|
|
101
|
-
this.env.types.secrets = await reflectSecrets(this, this.config.env.secrets?.file ?
|
|
101
|
+
this.env.types.secrets = await reflectSecrets(this, this.config.env.secrets?.file ? isParentPath(this.config.env.secrets?.file, this.workspaceConfig.workspaceRoot) ? this.config.env.secrets?.file : joinPaths(this.config.projectRoot, this.config.env.secrets?.file) : void 0, this.config.env.secrets?.name);
|
|
102
102
|
if (!this.env.types.secrets) throw new Error("Failed to find the secrets configuration type reflection in the context.");
|
|
103
103
|
await writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
|
|
104
104
|
this.log(LogLevelLabel.TRACE, `Resolved ${this.env.types.env.getProperties().length ?? 0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length ?? 0} secret configuration parameters`);
|
|
@@ -139,10 +139,10 @@ const plugin = (options = {}) => {
|
|
|
139
139
|
},
|
|
140
140
|
async docs() {
|
|
141
141
|
this.log(LogLevelLabel.TRACE, "Writing Environment documentation for the Powerlines project artifacts.");
|
|
142
|
-
const outputPath =
|
|
142
|
+
const outputPath = joinPaths(this.config.projectRoot, "docs", "generated");
|
|
143
143
|
if (!existsSync(outputPath)) await createDirectory(outputPath);
|
|
144
144
|
const reflection = await readEnvTypeReflection(this, "env");
|
|
145
|
-
const envDocFile =
|
|
145
|
+
const envDocFile = joinPaths(outputPath, "env.md");
|
|
146
146
|
this.log(LogLevelLabel.TRACE, `Documenting environment variables configuration in "${envDocFile}"`);
|
|
147
147
|
await this.fs.write(envDocFile, `<!-- Generated by ${titleCase(this.config.framework) || "Powerlines"} -->
|
|
148
148
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const require_is_object = require('./type-checks/src/is-object.cjs');
|
|
2
|
+
const require_is_string = require('./type-checks/src/is-string.cjs');
|
|
3
|
+
require('./type-checks/src/index.cjs');
|
|
4
|
+
|
|
5
|
+
//#region ../../node_modules/.pnpm/@stryke+convert@0.6.34/node_modules/@stryke/convert/dist/parse-type-definition.mjs
|
|
6
|
+
/**
|
|
7
|
+
* Parse a type definition parameter into a {@link TypeDefinition} object
|
|
8
|
+
*
|
|
9
|
+
* @param param - The parameter to parse
|
|
10
|
+
* @returns The parsed type definition
|
|
11
|
+
*/
|
|
12
|
+
const parseTypeDefinition = (param) => {
|
|
13
|
+
if (require_is_string.isString(param)) {
|
|
14
|
+
if (param.includes(":")) {
|
|
15
|
+
const params = param.split(":");
|
|
16
|
+
if (params.length > 1 && params[0]) return {
|
|
17
|
+
file: params[0],
|
|
18
|
+
name: params[1]
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (param.includes("#")) {
|
|
22
|
+
const params = param.split("#");
|
|
23
|
+
if (params.length > 1 && params[0]) return {
|
|
24
|
+
file: params[0],
|
|
25
|
+
name: params[1]
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return { file: param };
|
|
29
|
+
}
|
|
30
|
+
if (require_is_object.isObject(param)) return {
|
|
31
|
+
file: param.file,
|
|
32
|
+
name: param.name
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
exports.parseTypeDefinition = parseTypeDefinition;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { isObject } from "./type-checks/src/is-object.mjs";
|
|
2
|
+
import { isString } from "./type-checks/src/is-string.mjs";
|
|
3
|
+
import "./type-checks/src/index.mjs";
|
|
4
|
+
|
|
5
|
+
//#region ../../node_modules/.pnpm/@stryke+convert@0.6.34/node_modules/@stryke/convert/dist/parse-type-definition.mjs
|
|
6
|
+
/**
|
|
7
|
+
* Parse a type definition parameter into a {@link TypeDefinition} object
|
|
8
|
+
*
|
|
9
|
+
* @param param - The parameter to parse
|
|
10
|
+
* @returns The parsed type definition
|
|
11
|
+
*/
|
|
12
|
+
const parseTypeDefinition = (param) => {
|
|
13
|
+
if (isString(param)) {
|
|
14
|
+
if (param.includes(":")) {
|
|
15
|
+
const params = param.split(":");
|
|
16
|
+
if (params.length > 1 && params[0]) return {
|
|
17
|
+
file: params[0],
|
|
18
|
+
name: params[1]
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (param.includes("#")) {
|
|
22
|
+
const params = param.split("#");
|
|
23
|
+
if (params.length > 1 && params[0]) return {
|
|
24
|
+
file: params[0],
|
|
25
|
+
name: params[1]
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return { file: param };
|
|
29
|
+
}
|
|
30
|
+
if (isObject(param)) return {
|
|
31
|
+
file: param.file,
|
|
32
|
+
name: param.name
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { parseTypeDefinition };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../../node_modules/.pnpm/@stryke+convert@0.6.34/node_modules/@stryke/convert/dist/to-array.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Convert `Arrayable<T>` to `Array<T>`
|
|
5
|
+
*
|
|
6
|
+
* @param array - The `Arrayable<T>` to convert
|
|
7
|
+
* @returns An `Array<T>` containing the elements of the input
|
|
8
|
+
*/
|
|
9
|
+
function toArray(array) {
|
|
10
|
+
array = array ?? [];
|
|
11
|
+
return Array.isArray(array) ? array : [array];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.toArray = toArray;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/@stryke+convert@0.6.34/node_modules/@stryke/convert/dist/to-array.mjs
|
|
2
|
+
/**
|
|
3
|
+
* Convert `Arrayable<T>` to `Array<T>`
|
|
4
|
+
*
|
|
5
|
+
* @param array - The `Arrayable<T>` to convert
|
|
6
|
+
* @returns An `Array<T>` containing the elements of the input
|
|
7
|
+
*/
|
|
8
|
+
function toArray(array) {
|
|
9
|
+
array = array ?? [];
|
|
10
|
+
return Array.isArray(array) ? array : [array];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { toArray };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../../node_modules/.pnpm/@stryke+convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/get-object-tag.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Gets the `toStringTag` of `obj`.
|
|
5
|
+
*
|
|
6
|
+
* @param value - The obj to query.
|
|
7
|
+
* @returns Returns the `toStringTag`.
|
|
8
|
+
*/
|
|
9
|
+
const getObjectTag = (value) => {
|
|
10
|
+
if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
|
|
11
|
+
return Object.prototype.toString.call(value);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.getObjectTag = getObjectTag;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/@stryke+convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/get-object-tag.mjs
|
|
2
|
+
/**
|
|
3
|
+
* Gets the `toStringTag` of `obj`.
|
|
4
|
+
*
|
|
5
|
+
* @param value - The obj to query.
|
|
6
|
+
* @returns Returns the `toStringTag`.
|
|
7
|
+
*/
|
|
8
|
+
const getObjectTag = (value) => {
|
|
9
|
+
if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
|
|
10
|
+
return Object.prototype.toString.call(value);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { getObjectTag };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const require_is_plain_object = require('./is-plain-object.cjs');
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/@stryke+convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-object.mjs
|
|
4
|
+
/**
|
|
5
|
+
* Check if the provided value's type is `Object`
|
|
6
|
+
*
|
|
7
|
+
* @param value - The value to type check
|
|
8
|
+
* @returns An indicator specifying if the value provided is of type `Object`
|
|
9
|
+
*/
|
|
10
|
+
const isObject = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
return typeof value === "object" || Boolean(value) && value?.constructor === Object || require_is_plain_object.isPlainObject(value);
|
|
13
|
+
} catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.isObject = isObject;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { isPlainObject } from "./is-plain-object.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/@stryke+convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-object.mjs
|
|
4
|
+
/**
|
|
5
|
+
* Check if the provided value's type is `Object`
|
|
6
|
+
*
|
|
7
|
+
* @param value - The value to type check
|
|
8
|
+
* @returns An indicator specifying if the value provided is of type `Object`
|
|
9
|
+
*/
|
|
10
|
+
const isObject = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
return typeof value === "object" || Boolean(value) && value?.constructor === Object || isPlainObject(value);
|
|
13
|
+
} catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { isObject };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const require_get_object_tag = require('./get-object-tag.cjs');
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/@stryke+convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-plain-object.mjs
|
|
4
|
+
/**
|
|
5
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
6
|
+
* and has a `typeof` result of "object".
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* isObjectLike({})
|
|
11
|
+
* // => true
|
|
12
|
+
*
|
|
13
|
+
* isObjectLike([1, 2, 3])
|
|
14
|
+
* // => true
|
|
15
|
+
*
|
|
16
|
+
* isObjectLike(Function)
|
|
17
|
+
* // => false
|
|
18
|
+
*
|
|
19
|
+
* isObjectLike(null)
|
|
20
|
+
* // => false
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @param value - The value to check.
|
|
24
|
+
* @returns Returns `true` if `value` is object-like, else `false`.
|
|
25
|
+
*/
|
|
26
|
+
const isObjectLike = (obj) => {
|
|
27
|
+
return typeof obj === "object" && obj !== null;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* function Foo() {
|
|
35
|
+
* this.a = 1
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* isPlainObject(new Foo)
|
|
39
|
+
* // => false
|
|
40
|
+
*
|
|
41
|
+
* isPlainObject([1, 2, 3])
|
|
42
|
+
* // => false
|
|
43
|
+
*
|
|
44
|
+
* isPlainObject({ 'x': 0, 'y': 0 })
|
|
45
|
+
* // => true
|
|
46
|
+
*
|
|
47
|
+
* isPlainObject(Object.create(null))
|
|
48
|
+
* // => true
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @param obj - The value to check.
|
|
52
|
+
* @returns Returns `true` if `obj` is a plain object, else `false`.
|
|
53
|
+
*/
|
|
54
|
+
const isPlainObject = (obj) => {
|
|
55
|
+
if (!isObjectLike(obj) || require_get_object_tag.getObjectTag(obj) !== "[object Object]") return false;
|
|
56
|
+
if (Object.getPrototypeOf(obj) === null) return true;
|
|
57
|
+
let proto = obj;
|
|
58
|
+
while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
|
|
59
|
+
return Object.getPrototypeOf(obj) === proto;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
exports.isPlainObject = isPlainObject;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { getObjectTag } from "./get-object-tag.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/@stryke+convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-plain-object.mjs
|
|
4
|
+
/**
|
|
5
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
6
|
+
* and has a `typeof` result of "object".
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* isObjectLike({})
|
|
11
|
+
* // => true
|
|
12
|
+
*
|
|
13
|
+
* isObjectLike([1, 2, 3])
|
|
14
|
+
* // => true
|
|
15
|
+
*
|
|
16
|
+
* isObjectLike(Function)
|
|
17
|
+
* // => false
|
|
18
|
+
*
|
|
19
|
+
* isObjectLike(null)
|
|
20
|
+
* // => false
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @param value - The value to check.
|
|
24
|
+
* @returns Returns `true` if `value` is object-like, else `false`.
|
|
25
|
+
*/
|
|
26
|
+
const isObjectLike = (obj) => {
|
|
27
|
+
return typeof obj === "object" && obj !== null;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* function Foo() {
|
|
35
|
+
* this.a = 1
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* isPlainObject(new Foo)
|
|
39
|
+
* // => false
|
|
40
|
+
*
|
|
41
|
+
* isPlainObject([1, 2, 3])
|
|
42
|
+
* // => false
|
|
43
|
+
*
|
|
44
|
+
* isPlainObject({ 'x': 0, 'y': 0 })
|
|
45
|
+
* // => true
|
|
46
|
+
*
|
|
47
|
+
* isPlainObject(Object.create(null))
|
|
48
|
+
* // => true
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @param obj - The value to check.
|
|
52
|
+
* @returns Returns `true` if `obj` is a plain object, else `false`.
|
|
53
|
+
*/
|
|
54
|
+
const isPlainObject = (obj) => {
|
|
55
|
+
if (!isObjectLike(obj) || getObjectTag(obj) !== "[object Object]") return false;
|
|
56
|
+
if (Object.getPrototypeOf(obj) === null) return true;
|
|
57
|
+
let proto = obj;
|
|
58
|
+
while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
|
|
59
|
+
return Object.getPrototypeOf(obj) === proto;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
export { isPlainObject };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../../node_modules/.pnpm/@stryke+convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-string.mjs
|
|
3
|
+
const isString = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
return typeof value === "string";
|
|
6
|
+
} catch {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
exports.isString = isString;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/@stryke+convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-string.mjs
|
|
2
|
+
const isString = (value) => {
|
|
3
|
+
try {
|
|
4
|
+
return typeof value === "string";
|
|
5
|
+
} catch {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { isString };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require('./is-buffer.cjs');
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/@stryke+convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/type-detect.mjs
|
|
4
|
+
((Obj) => {
|
|
5
|
+
if (typeof globalThis === "object") return globalThis;
|
|
6
|
+
Object.defineProperty(Obj, "typeDetectGlobalObject", {
|
|
7
|
+
get() {
|
|
8
|
+
return this;
|
|
9
|
+
},
|
|
10
|
+
configurable: true
|
|
11
|
+
});
|
|
12
|
+
return globalThis;
|
|
13
|
+
})(Object.prototype);
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "./is-buffer.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/@stryke+convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/type-detect.mjs
|
|
4
|
+
((Obj) => {
|
|
5
|
+
if (typeof globalThis === "object") return globalThis;
|
|
6
|
+
Object.defineProperty(Obj, "typeDetectGlobalObject", {
|
|
7
|
+
get() {
|
|
8
|
+
return this;
|
|
9
|
+
},
|
|
10
|
+
configurable: true
|
|
11
|
+
});
|
|
12
|
+
return globalThis;
|
|
13
|
+
})(Object.prototype);
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const require_slash = require('./slash.cjs');
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/@stryke+path@0.25.3/node_modules/@stryke/path/dist/is-parent-path.mjs
|
|
4
|
+
/**
|
|
5
|
+
* Check if a given path is a parent of another path.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project/src");
|
|
10
|
+
* // returns true
|
|
11
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project");
|
|
12
|
+
* // returns true
|
|
13
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project/src/other");
|
|
14
|
+
* // returns false
|
|
15
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/other");
|
|
16
|
+
* // returns false
|
|
17
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project/src/index.ts");
|
|
18
|
+
* // returns false
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param childPath - The path to check if it is a child of the parent path.
|
|
22
|
+
* @param parentPath - The path to check if it is a parent of the child path.
|
|
23
|
+
* @returns `true` if `childPath` is a child of `parentPath`, otherwise `false`.
|
|
24
|
+
*/
|
|
25
|
+
function isParentPath(childPath, parentPath) {
|
|
26
|
+
const normalizedChild = require_slash.slash(childPath.replaceAll(/\\/g, "/").replace(/\/*$/, ""))?.toLowerCase();
|
|
27
|
+
const normalizedParent = require_slash.slash(parentPath.replaceAll(/\\/g, "/").replace(/\/*$/, ""))?.toLowerCase();
|
|
28
|
+
return childPath !== parentPath && normalizedChild !== normalizedParent && normalizedChild.startsWith(`${normalizedParent}/`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.isParentPath = isParentPath;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { slash } from "./slash.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/@stryke+path@0.25.3/node_modules/@stryke/path/dist/is-parent-path.mjs
|
|
4
|
+
/**
|
|
5
|
+
* Check if a given path is a parent of another path.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project/src");
|
|
10
|
+
* // returns true
|
|
11
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project");
|
|
12
|
+
* // returns true
|
|
13
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project/src/other");
|
|
14
|
+
* // returns false
|
|
15
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/other");
|
|
16
|
+
* // returns false
|
|
17
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project/src/index.ts");
|
|
18
|
+
* // returns false
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param childPath - The path to check if it is a child of the parent path.
|
|
22
|
+
* @param parentPath - The path to check if it is a parent of the child path.
|
|
23
|
+
* @returns `true` if `childPath` is a child of `parentPath`, otherwise `false`.
|
|
24
|
+
*/
|
|
25
|
+
function isParentPath(childPath, parentPath) {
|
|
26
|
+
const normalizedChild = slash(childPath.replaceAll(/\\/g, "/").replace(/\/*$/, ""))?.toLowerCase();
|
|
27
|
+
const normalizedParent = slash(parentPath.replaceAll(/\\/g, "/").replace(/\/*$/, ""))?.toLowerCase();
|
|
28
|
+
return childPath !== parentPath && normalizedChild !== normalizedParent && normalizedChild.startsWith(`${normalizedParent}/`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { isParentPath };
|
package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/is-type.cjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const require_regex = require('./regex.cjs');
|
|
2
|
+
const require_slash = require('./slash.cjs');
|
|
3
|
+
|
|
4
|
+
//#region ../../node_modules/.pnpm/@stryke+path@0.25.3/node_modules/@stryke/path/dist/is-type.mjs
|
|
5
|
+
/**
|
|
6
|
+
* Check if the path is an absolute path.
|
|
7
|
+
*
|
|
8
|
+
* @param path - The path to check
|
|
9
|
+
* @returns An indicator specifying if the path is an absolute path
|
|
10
|
+
*/
|
|
11
|
+
function isAbsolutePath(path) {
|
|
12
|
+
return require_regex.ABSOLUTE_PATH_REGEX.test(require_slash.slash(path));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Check if the path is an absolute path.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* This is an alias for {@link isAbsolutePath}.
|
|
19
|
+
*
|
|
20
|
+
* @param path - The path to check
|
|
21
|
+
* @returns An indicator specifying if the path is an absolute path
|
|
22
|
+
*/
|
|
23
|
+
function isAbsolute(path) {
|
|
24
|
+
return isAbsolutePath(path);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.isAbsolute = isAbsolute;
|
package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/is-type.mjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ABSOLUTE_PATH_REGEX } from "./regex.mjs";
|
|
2
|
+
import { slash } from "./slash.mjs";
|
|
3
|
+
|
|
4
|
+
//#region ../../node_modules/.pnpm/@stryke+path@0.25.3/node_modules/@stryke/path/dist/is-type.mjs
|
|
5
|
+
/**
|
|
6
|
+
* Check if the path is an absolute path.
|
|
7
|
+
*
|
|
8
|
+
* @param path - The path to check
|
|
9
|
+
* @returns An indicator specifying if the path is an absolute path
|
|
10
|
+
*/
|
|
11
|
+
function isAbsolutePath(path) {
|
|
12
|
+
return ABSOLUTE_PATH_REGEX.test(slash(path));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Check if the path is an absolute path.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* This is an alias for {@link isAbsolutePath}.
|
|
19
|
+
*
|
|
20
|
+
* @param path - The path to check
|
|
21
|
+
* @returns An indicator specifying if the path is an absolute path
|
|
22
|
+
*/
|
|
23
|
+
function isAbsolute(path) {
|
|
24
|
+
return isAbsolutePath(path);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { isAbsolute };
|