@powerlines/plugin-env 0.15.9 → 0.15.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/dist/babel/plugin.cjs +1 -1
- package/dist/babel/plugin.mjs +1 -1
- package/dist/helpers/load.cjs +2 -2
- package/dist/helpers/load.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/plugin-alloy/src/core/components/source-file.cjs +1 -1
- package/dist/plugin-alloy/src/core/components/source-file.mjs +1 -1
- package/dist/plugin-alloy/src/index.cjs +12 -5
- package/dist/plugin-alloy/src/index.mjs +12 -5
- package/dist/plugin-alloy/src/types/components.d.cts +1 -3
- package/dist/plugin-alloy/src/types/components.d.mts +2 -3
- package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +1 -1
- package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +1 -1
- package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +17 -11
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +1 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +1 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +17 -11
- package/dist/plugin-automd/src/index.cjs +2 -2
- package/dist/plugin-automd/src/index.mjs +1 -1
- package/dist/plugin-babel/src/helpers/module-helpers.cjs +1 -1
- package/dist/plugin-babel/src/helpers/module-helpers.mjs +1 -1
- package/dist/plugin-babel/src/index.cjs +4 -7
- package/dist/plugin-babel/src/index.mjs +2 -5
- package/dist/powerlines/src/api.d.mts +2 -2
- package/dist/powerlines/src/index.d.mts +8 -5
- package/dist/powerlines/src/internal/helpers/hooks.cjs +37 -19
- package/dist/powerlines/src/internal/helpers/hooks.d.cts +47 -0
- package/dist/powerlines/src/internal/helpers/hooks.d.mts +46 -2
- package/dist/powerlines/src/internal/helpers/hooks.mjs +37 -20
- package/dist/powerlines/src/lib/build/esbuild.cjs +2 -2
- package/dist/powerlines/src/lib/build/esbuild.mjs +2 -2
- package/dist/powerlines/src/lib/entry.cjs +1 -1
- package/dist/powerlines/src/lib/entry.mjs +1 -1
- package/dist/powerlines/src/types/api.cjs +62 -1
- package/dist/powerlines/src/types/api.d.cts +104 -0
- package/dist/powerlines/src/types/api.d.mts +104 -5
- package/dist/powerlines/src/types/api.mjs +61 -2
- package/dist/powerlines/src/types/build.cjs +26 -4
- package/dist/powerlines/src/types/build.d.cts +43 -3
- package/dist/powerlines/src/types/build.d.mts +42 -4
- package/dist/powerlines/src/types/build.mjs +23 -3
- package/dist/powerlines/src/types/config.cjs +107 -0
- package/dist/powerlines/src/types/config.d.cts +60 -4
- package/dist/powerlines/src/types/config.d.mts +61 -5
- package/dist/powerlines/src/types/config.mjs +99 -1
- package/dist/powerlines/src/types/context.cjs +57 -0
- package/dist/powerlines/src/types/context.d.cts +113 -1
- package/dist/powerlines/src/types/context.d.mts +113 -3
- package/dist/powerlines/src/types/context.mjs +54 -1
- package/dist/powerlines/src/types/hooks.cjs +33 -14
- package/dist/powerlines/src/types/hooks.d.cts +32 -0
- package/dist/powerlines/src/types/hooks.d.mts +32 -2
- package/dist/powerlines/src/types/hooks.mjs +32 -12
- package/dist/powerlines/src/types/index.cjs +3 -3
- package/dist/powerlines/src/types/index.d.mts +8 -8
- package/dist/powerlines/src/types/index.mjs +7 -7
- package/dist/powerlines/src/types/plugin.cjs +40 -105
- package/dist/powerlines/src/types/plugin.d.cts +35 -61
- package/dist/powerlines/src/types/plugin.d.mts +35 -61
- package/dist/powerlines/src/types/plugin.mjs +40 -102
- package/dist/powerlines/src/types/resolved.d.cts +16 -4
- package/dist/powerlines/src/types/resolved.d.mts +16 -5
- package/dist/powerlines/src/types/unplugin.cjs +47 -1
- package/dist/powerlines/src/types/unplugin.d.cts +22 -0
- package/dist/powerlines/src/types/unplugin.d.mts +22 -6
- package/dist/powerlines/src/types/unplugin.mjs +45 -2
- package/package.json +9 -9
package/dist/babel/plugin.cjs
CHANGED
|
@@ -8,8 +8,8 @@ const require_reflection = require('../deepkit/schemas/reflection2.cjs');
|
|
|
8
8
|
const require_utilities = require('../deepkit/src/utilities.cjs');
|
|
9
9
|
const require_persistence = require('../helpers/persistence.cjs');
|
|
10
10
|
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
11
|
-
let __babel_core = require("@babel/core");
|
|
12
11
|
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
12
|
+
let __babel_core = require("@babel/core");
|
|
13
13
|
let __stryke_capnp = require("@stryke/capnp");
|
|
14
14
|
__stryke_capnp = require_rolldown_runtime.__toESM(__stryke_capnp);
|
|
15
15
|
let __stryke_fs_buffer = require("@stryke/fs/buffer");
|
package/dist/babel/plugin.mjs
CHANGED
|
@@ -7,8 +7,8 @@ import { SerializedTypes } from "../deepkit/schemas/reflection2.mjs";
|
|
|
7
7
|
import { stringifyDefaultValue } from "../deepkit/src/utilities.mjs";
|
|
8
8
|
import { getEnvReflectionsPath } from "../helpers/persistence.mjs";
|
|
9
9
|
import { ReflectionClass, ReflectionKind, deserializeType, resolveClassType } from "@powerlines/deepkit/vendor/type";
|
|
10
|
-
import { NodePath } from "@babel/core";
|
|
11
10
|
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
11
|
+
import { NodePath } from "@babel/core";
|
|
12
12
|
import * as capnp from "@stryke/capnp";
|
|
13
13
|
import { readFileBufferSync } from "@stryke/fs/buffer";
|
|
14
14
|
import { existsSync } from "node:fs";
|
package/dist/helpers/load.cjs
CHANGED
|
@@ -2,10 +2,10 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
|
2
2
|
const require_config = require('../powerlines/src/types/config.cjs');
|
|
3
3
|
const require_types_plugin = require('../types/plugin.cjs');
|
|
4
4
|
const require_source_file_env = require('./source-file-env.cjs');
|
|
5
|
-
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
6
|
-
let c12 = require("c12");
|
|
7
5
|
let defu = require("defu");
|
|
8
6
|
defu = require_rolldown_runtime.__toESM(defu);
|
|
7
|
+
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
8
|
+
let c12 = require("c12");
|
|
9
9
|
let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
10
10
|
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
11
11
|
let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
package/dist/helpers/load.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __ΩWorkspaceConfig } from "../powerlines/src/types/config.mjs";
|
|
2
2
|
import { __ΩEnvPluginContext, __ΩEnvPluginOptions } from "../types/plugin.mjs";
|
|
3
3
|
import { removeEnvPrefix } from "./source-file-env.mjs";
|
|
4
|
+
import defu$1 from "defu";
|
|
4
5
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
5
6
|
import { loadConfig } from "c12";
|
|
6
|
-
import defu$1 from "defu";
|
|
7
7
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
8
8
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
9
9
|
import { kebabCase } from "@stryke/string-format/kebab-case";
|
package/dist/index.cjs
CHANGED
|
@@ -21,10 +21,10 @@ require('./helpers/index.cjs');
|
|
|
21
21
|
require('./types/index.cjs');
|
|
22
22
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
23
23
|
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
24
|
-
let
|
|
24
|
+
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
25
25
|
let defu = require("defu");
|
|
26
26
|
defu = require_rolldown_runtime.__toESM(defu);
|
|
27
|
-
let
|
|
27
|
+
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
28
28
|
let __stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
|
|
29
29
|
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
30
30
|
let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
|
package/dist/index.mjs
CHANGED
|
@@ -19,9 +19,9 @@ import "./helpers/index.mjs";
|
|
|
19
19
|
import "./types/index.mjs";
|
|
20
20
|
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
21
21
|
import { ReflectionClass, ReflectionKind, stringifyType } from "@powerlines/deepkit/vendor/type";
|
|
22
|
-
import { toArray } from "@stryke/convert/to-array";
|
|
23
|
-
import defu$1 from "defu";
|
|
24
22
|
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
23
|
+
import defu$1 from "defu";
|
|
24
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
25
25
|
import { isParentPath } from "@stryke/path/is-parent-path";
|
|
26
26
|
import { titleCase } from "@stryke/string-format/title-case";
|
|
27
27
|
import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
|
|
@@ -3,9 +3,9 @@ const require_context = require('../contexts/context.cjs');
|
|
|
3
3
|
require('../contexts/index.cjs');
|
|
4
4
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
5
|
let __alloy_js_core = require("@alloy-js/core");
|
|
6
|
-
let __stryke_path_append = require("@stryke/path/append");
|
|
7
6
|
let defu = require("defu");
|
|
8
7
|
defu = require_rolldown_runtime.__toESM(defu);
|
|
8
|
+
let __stryke_path_append = require("@stryke/path/append");
|
|
9
9
|
|
|
10
10
|
//#region ../plugin-alloy/src/core/components/source-file.tsx
|
|
11
11
|
/**
|
|
@@ -2,8 +2,8 @@ import { useMeta } from "../contexts/context.mjs";
|
|
|
2
2
|
import "../contexts/index.mjs";
|
|
3
3
|
import { createComponent, createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
4
4
|
import { Show, SourceDirectoryContext, SourceFileContext, getContext, splitProps, useContext, useFormatOptions } from "@alloy-js/core";
|
|
5
|
-
import { appendPath } from "@stryke/path/append";
|
|
6
5
|
import defu$1 from "defu";
|
|
6
|
+
import { appendPath } from "@stryke/path/append";
|
|
7
7
|
|
|
8
8
|
//#region ../plugin-alloy/src/core/components/source-file.tsx
|
|
9
9
|
/**
|
|
@@ -23,11 +23,18 @@ const plugin = (options = {}) => {
|
|
|
23
23
|
...options
|
|
24
24
|
},
|
|
25
25
|
build: {
|
|
26
|
-
inputOptions: { transform: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
inputOptions: { transform: {
|
|
27
|
+
typescript: {
|
|
28
|
+
jsxPragma: "Alloy.createElement",
|
|
29
|
+
jsxPragmaFrag: "Alloy.Fragment"
|
|
30
|
+
},
|
|
31
|
+
jsx: {
|
|
32
|
+
runtime: "classic",
|
|
33
|
+
pragma: "Alloy.createElement",
|
|
34
|
+
pragmaFrag: "Alloy.Fragment",
|
|
35
|
+
importSource: "@alloy-js/core"
|
|
36
|
+
}
|
|
37
|
+
} },
|
|
31
38
|
plugins: [(0, __alloy_js_rollup_plugin.default)()],
|
|
32
39
|
external: [
|
|
33
40
|
"@alloy-js/core",
|
|
@@ -21,11 +21,18 @@ const plugin = (options = {}) => {
|
|
|
21
21
|
...options
|
|
22
22
|
},
|
|
23
23
|
build: {
|
|
24
|
-
inputOptions: { transform: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
inputOptions: { transform: {
|
|
25
|
+
typescript: {
|
|
26
|
+
jsxPragma: "Alloy.createElement",
|
|
27
|
+
jsxPragmaFrag: "Alloy.Fragment"
|
|
28
|
+
},
|
|
29
|
+
jsx: {
|
|
30
|
+
runtime: "classic",
|
|
31
|
+
pragma: "Alloy.createElement",
|
|
32
|
+
pragmaFrag: "Alloy.Fragment",
|
|
33
|
+
importSource: "@alloy-js/core"
|
|
34
|
+
}
|
|
35
|
+
} },
|
|
29
36
|
plugins: [alloy()],
|
|
30
37
|
external: [
|
|
31
38
|
"@alloy-js/core",
|
|
@@ -15,8 +15,6 @@ interface TypescriptFileImportItem {
|
|
|
15
15
|
alias?: string;
|
|
16
16
|
type?: boolean;
|
|
17
17
|
}
|
|
18
|
-
type TypescriptFileImports = Record<string, null | Array<TypescriptFileImportItem | string
|
|
19
|
-
$builtins?: Record<string, null | Array<TypescriptFileImportItem | string>>;
|
|
20
|
-
};
|
|
18
|
+
type TypescriptFileImports = Record<string, null | Array<TypescriptFileImportItem | string>>;
|
|
21
19
|
//#endregion
|
|
22
20
|
export { ComponentProps, TypescriptFileImportItem, TypescriptFileImports };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "../../../powerlines/src/types/fs.mjs";
|
|
1
2
|
import "../../../powerlines/src/types/resolved.mjs";
|
|
2
3
|
import { Children } from "@alloy-js/core";
|
|
3
4
|
import { SourceFileContext as SourceFileContext$1 } from "@alloy-js/typescript";
|
|
@@ -16,8 +17,6 @@ interface TypescriptFileImportItem {
|
|
|
16
17
|
alias?: string;
|
|
17
18
|
type?: boolean;
|
|
18
19
|
}
|
|
19
|
-
type TypescriptFileImports = Record<string, null | Array<TypescriptFileImportItem | string
|
|
20
|
-
$builtins?: Record<string, null | Array<TypescriptFileImportItem | string>>;
|
|
21
|
-
};
|
|
20
|
+
type TypescriptFileImports = Record<string, null | Array<TypescriptFileImportItem | string>>;
|
|
22
21
|
//#endregion
|
|
23
22
|
export { ComponentProps, TypescriptFileImportItem, TypescriptFileImports };
|
|
@@ -5,8 +5,8 @@ const require_typescript_file = require('./typescript-file.cjs');
|
|
|
5
5
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
6
|
let __alloy_js_core = require("@alloy-js/core");
|
|
7
7
|
let __stryke_path_replace = require("@stryke/path/replace");
|
|
8
|
-
let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
9
8
|
let __stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
|
|
9
|
+
let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
10
10
|
|
|
11
11
|
//#region ../plugin-alloy/src/typescript/components/builtin-file.tsx
|
|
12
12
|
/**
|
|
@@ -4,8 +4,8 @@ import { TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports } fro
|
|
|
4
4
|
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
5
5
|
import { computed, splitProps } from "@alloy-js/core";
|
|
6
6
|
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
7
|
-
import { hasFileExtension } from "@stryke/path/file-path-fns";
|
|
8
7
|
import { isSet } from "@stryke/type-checks/is-set";
|
|
8
|
+
import { hasFileExtension } from "@stryke/path/file-path-fns";
|
|
9
9
|
|
|
10
10
|
//#region ../plugin-alloy/src/typescript/components/builtin-file.tsx
|
|
11
11
|
/**
|
|
@@ -4,8 +4,8 @@ const require_single_line_comment = require('../../core/components/single-line-c
|
|
|
4
4
|
const require_source_file = require('../../core/components/source-file.cjs');
|
|
5
5
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
6
|
let __alloy_js_core = require("@alloy-js/core");
|
|
7
|
-
let __stryke_path_append = require("@stryke/path/append");
|
|
8
7
|
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
8
|
+
let __stryke_path_append = require("@stryke/path/append");
|
|
9
9
|
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
10
10
|
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
11
11
|
let __stryke_type_checks_is_boolean = require("@stryke/type-checks/is-boolean");
|
|
@@ -152,13 +152,13 @@ function TypescriptFileHeader(props) {
|
|
|
152
152
|
* @returns The rendered source file header.
|
|
153
153
|
*/
|
|
154
154
|
function TypescriptFileHeaderImports(props) {
|
|
155
|
-
const { imports } = props;
|
|
155
|
+
const { imports, builtinImports } = props;
|
|
156
156
|
const context = require_context.usePowerlines();
|
|
157
157
|
const sourceFile = (0, __alloy_js_typescript.useSourceFile)();
|
|
158
158
|
const scope = props.scope ?? sourceFile.scope;
|
|
159
159
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
160
160
|
get when() {
|
|
161
|
-
return scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0;
|
|
161
|
+
return scope.importedModules.size > 0 || !!builtinImports && Object.keys(builtinImports).length > 0 || !!imports && Object.keys(imports).length > 0;
|
|
162
162
|
},
|
|
163
163
|
get children() {
|
|
164
164
|
return [
|
|
@@ -171,19 +171,25 @@ function TypescriptFileHeaderImports(props) {
|
|
|
171
171
|
get each() {
|
|
172
172
|
return Object.entries(imports ?? {});
|
|
173
173
|
},
|
|
174
|
-
children: ([module$1,
|
|
175
|
-
if (module$1 === "$builtins") return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
176
|
-
get each() {
|
|
177
|
-
return Object.entries(imported ?? {});
|
|
178
|
-
},
|
|
179
|
-
children: ([builtinModule, builtinImports]) => __alloy_js_core.code`import ${builtinImports === null ? "" : ` from ${builtinImports.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (builtinImports.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && builtinImports.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (builtinImports.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${builtinImports.map((i) => (0, __stryke_type_checks_is_string.isString)(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} "${builtinModule.includes(":") ? builtinModule : `${context.config.output.builtinPrefix}:${builtinModule}`}";`
|
|
180
|
-
});
|
|
181
|
-
const normalImports = imported;
|
|
174
|
+
children: ([module$1, normalImports]) => {
|
|
182
175
|
return __alloy_js_core.code`import ${normalImports === null ? "" : ` from ${normalImports.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (normalImports.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && normalImports.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (normalImports.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${normalImports.map((i) => (0, __stryke_type_checks_is_string.isString)(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} "${module$1}";`;
|
|
183
176
|
}
|
|
184
177
|
});
|
|
185
178
|
}
|
|
186
179
|
}),
|
|
180
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
181
|
+
get when() {
|
|
182
|
+
return builtinImports && Object.keys(builtinImports).length > 0;
|
|
183
|
+
},
|
|
184
|
+
get children() {
|
|
185
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
186
|
+
get each() {
|
|
187
|
+
return Object.entries(builtinImports ?? {});
|
|
188
|
+
},
|
|
189
|
+
children: ([builtinModule, builtinImports$1]) => __alloy_js_core.code`import ${builtinImports$1 === null ? "" : ` from ${builtinImports$1.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (builtinImports$1.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && builtinImports$1.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (builtinImports$1.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${builtinImports$1.map((i) => (0, __stryke_type_checks_is_string.isString)(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} "${builtinModule.includes(":") ? builtinModule : `${context.config.output.builtinPrefix}:${builtinModule}`}";`
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}),
|
|
187
193
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
188
194
|
get when() {
|
|
189
195
|
return scope.importedModules.size > 0;
|
|
@@ -3,8 +3,8 @@ import { SingleLineComment } from "../../core/components/single-line-comment.mjs
|
|
|
3
3
|
import { SourceFile } from "../../core/components/source-file.mjs";
|
|
4
4
|
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
5
5
|
import { For, Scope, Show, SourceDirectoryContext, code, splitProps, useContext, useScope } from "@alloy-js/core";
|
|
6
|
-
import { appendPath } from "@stryke/path/append";
|
|
7
6
|
import { isString } from "@stryke/type-checks/is-string";
|
|
7
|
+
import { appendPath } from "@stryke/path/append";
|
|
8
8
|
import { titleCase } from "@stryke/string-format/title-case";
|
|
9
9
|
import { ImportStatements, PackageContext, SourceFileContext as SourceFileContext$1, TSModuleScope, getSourceDirectoryData, useSourceFile } from "@alloy-js/typescript";
|
|
10
10
|
import { isBoolean } from "@stryke/type-checks/is-boolean";
|
|
@@ -151,13 +151,13 @@ function TypescriptFileHeader(props) {
|
|
|
151
151
|
* @returns The rendered source file header.
|
|
152
152
|
*/
|
|
153
153
|
function TypescriptFileHeaderImports(props) {
|
|
154
|
-
const { imports } = props;
|
|
154
|
+
const { imports, builtinImports } = props;
|
|
155
155
|
const context = usePowerlines();
|
|
156
156
|
const sourceFile = useSourceFile();
|
|
157
157
|
const scope = props.scope ?? sourceFile.scope;
|
|
158
158
|
return createComponent(Show, {
|
|
159
159
|
get when() {
|
|
160
|
-
return scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0;
|
|
160
|
+
return scope.importedModules.size > 0 || !!builtinImports && Object.keys(builtinImports).length > 0 || !!imports && Object.keys(imports).length > 0;
|
|
161
161
|
},
|
|
162
162
|
get children() {
|
|
163
163
|
return [
|
|
@@ -170,19 +170,25 @@ function TypescriptFileHeaderImports(props) {
|
|
|
170
170
|
get each() {
|
|
171
171
|
return Object.entries(imports ?? {});
|
|
172
172
|
},
|
|
173
|
-
children: ([module,
|
|
174
|
-
if (module === "$builtins") return createComponent(For, {
|
|
175
|
-
get each() {
|
|
176
|
-
return Object.entries(imported ?? {});
|
|
177
|
-
},
|
|
178
|
-
children: ([builtinModule, builtinImports]) => code`import ${builtinImports === null ? "" : ` from ${builtinImports.filter((i) => !isString(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (builtinImports.filter((i) => !isString(i) && i.default).length > 0 && builtinImports.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (builtinImports.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${builtinImports.map((i) => isString(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} "${builtinModule.includes(":") ? builtinModule : `${context.config.output.builtinPrefix}:${builtinModule}`}";`
|
|
179
|
-
});
|
|
180
|
-
const normalImports = imported;
|
|
173
|
+
children: ([module, normalImports]) => {
|
|
181
174
|
return code`import ${normalImports === null ? "" : ` from ${normalImports.filter((i) => !isString(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (normalImports.filter((i) => !isString(i) && i.default).length > 0 && normalImports.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (normalImports.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${normalImports.map((i) => isString(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} "${module}";`;
|
|
182
175
|
}
|
|
183
176
|
});
|
|
184
177
|
}
|
|
185
178
|
}),
|
|
179
|
+
createComponent(Show, {
|
|
180
|
+
get when() {
|
|
181
|
+
return builtinImports && Object.keys(builtinImports).length > 0;
|
|
182
|
+
},
|
|
183
|
+
get children() {
|
|
184
|
+
return createComponent(For, {
|
|
185
|
+
get each() {
|
|
186
|
+
return Object.entries(builtinImports ?? {});
|
|
187
|
+
},
|
|
188
|
+
children: ([builtinModule, builtinImports$1]) => code`import ${builtinImports$1 === null ? "" : ` from ${builtinImports$1.filter((i) => !isString(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (builtinImports$1.filter((i) => !isString(i) && i.default).length > 0 && builtinImports$1.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (builtinImports$1.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${builtinImports$1.map((i) => isString(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} "${builtinModule.includes(":") ? builtinModule : `${context.config.output.builtinPrefix}:${builtinModule}`}";`
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}),
|
|
186
192
|
createComponent(Show, {
|
|
187
193
|
get when() {
|
|
188
194
|
return scope.importedModules.size > 0;
|
|
@@ -3,6 +3,8 @@ const require_toc = require('./types/toc.cjs');
|
|
|
3
3
|
const require_plugin = require('./types/plugin.cjs');
|
|
4
4
|
const require_plugin$1 = require('../../powerlines/src/types/plugin.cjs');
|
|
5
5
|
let __stryke_path_replace = require("@stryke/path/replace");
|
|
6
|
+
let defu = require("defu");
|
|
7
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
6
8
|
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
7
9
|
let __stryke_fs_is_file = require("@stryke/fs/is-file");
|
|
8
10
|
let __stryke_fs_list_files = require("@stryke/fs/list-files");
|
|
@@ -11,8 +13,6 @@ let __stryke_path_is_type = require("@stryke/path/is-type");
|
|
|
11
13
|
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
12
14
|
let automd = require("automd");
|
|
13
15
|
let c12 = require("c12");
|
|
14
|
-
let defu = require("defu");
|
|
15
|
-
defu = require_rolldown_runtime.__toESM(defu);
|
|
16
16
|
let markdown_toc = require("markdown-toc");
|
|
17
17
|
markdown_toc = require_rolldown_runtime.__toESM(markdown_toc);
|
|
18
18
|
|
|
@@ -2,6 +2,7 @@ import { __ΩTOCOptions } from "./types/toc.mjs";
|
|
|
2
2
|
import { __ΩAutoMDPluginOptions } from "./types/plugin.mjs";
|
|
3
3
|
import { __ΩPlugin } from "../../powerlines/src/types/plugin.mjs";
|
|
4
4
|
import { replacePath } from "@stryke/path/replace";
|
|
5
|
+
import defu$1 from "defu";
|
|
5
6
|
import { toArray } from "@stryke/convert/to-array";
|
|
6
7
|
import { isDirectory } from "@stryke/fs/is-file";
|
|
7
8
|
import { listFiles } from "@stryke/fs/list-files";
|
|
@@ -10,7 +11,6 @@ import { isAbsolutePath } from "@stryke/path/is-type";
|
|
|
10
11
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
11
12
|
import { loadConfig, resolveConfig, transform } from "automd";
|
|
12
13
|
import { loadConfig as loadConfig$1 } from "c12";
|
|
13
|
-
import defu$1 from "defu";
|
|
14
14
|
import toc from "markdown-toc";
|
|
15
15
|
|
|
16
16
|
//#region ../plugin-automd/src/index.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_babel = require('../../../powerlines/src/types/babel.cjs');
|
|
3
3
|
const require_ast_utils = require('./ast-utils.cjs');
|
|
4
|
-
let __babel_core = require("@babel/core");
|
|
5
4
|
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
5
|
+
let __babel_core = require("@babel/core");
|
|
6
6
|
let __babel_types = require("@babel/types");
|
|
7
7
|
__babel_types = require_rolldown_runtime.__toESM(__babel_types);
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __ΩImportSpecifier } from "../../../powerlines/src/types/babel.mjs";
|
|
2
2
|
import { parseAst } from "./ast-utils.mjs";
|
|
3
|
-
import { NodePath } from "@babel/core";
|
|
4
3
|
import { isString } from "@stryke/type-checks/is-string";
|
|
4
|
+
import { NodePath } from "@babel/core";
|
|
5
5
|
import * as t from "@babel/types";
|
|
6
6
|
|
|
7
7
|
//#region ../plugin-babel/src/helpers/module-helpers.ts
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_plugin = require('
|
|
3
|
-
const require_plugin$1 = require('./types/plugin.cjs');
|
|
2
|
+
const require_plugin = require('./types/plugin.cjs');
|
|
4
3
|
const require_filters = require('./helpers/filters.cjs');
|
|
5
4
|
const require_options = require('./helpers/options.cjs');
|
|
6
5
|
const require_ast_utils = require('./helpers/ast-utils.cjs');
|
|
7
6
|
const require_create_plugin = require('./helpers/create-plugin.cjs');
|
|
8
7
|
const require_module_helpers = require('./helpers/module-helpers.cjs');
|
|
9
8
|
require('./helpers/index.cjs');
|
|
9
|
+
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
10
10
|
let defu = require("defu");
|
|
11
11
|
defu = require_rolldown_runtime.__toESM(defu);
|
|
12
12
|
let __babel_core = require("@babel/core");
|
|
13
|
-
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
14
13
|
let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
15
14
|
let __stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
|
|
16
15
|
let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
@@ -120,13 +119,11 @@ const plugin = __assignType((options = {}) => {
|
|
|
120
119
|
}
|
|
121
120
|
};
|
|
122
121
|
}, [
|
|
123
|
-
() => require_plugin
|
|
122
|
+
() => require_plugin.__ΩBabelPluginOptions,
|
|
124
123
|
"options",
|
|
125
124
|
() => ({}),
|
|
126
|
-
() => require_plugin.__ΩPlugin,
|
|
127
|
-
() => require_plugin$1.__ΩBabelPluginContext,
|
|
128
125
|
"",
|
|
129
|
-
"Pn!2\"
|
|
126
|
+
"Pn!2\">#\"/$"
|
|
130
127
|
]);
|
|
131
128
|
var src_default = plugin;
|
|
132
129
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __ΩPlugin } from "../../powerlines/src/types/plugin.mjs";
|
|
2
1
|
import { __ΩBabelPluginContext, __ΩBabelPluginOptions, __ΩBabelPluginResolvedConfig, __ΩBabelPluginUserConfig } from "./types/plugin.mjs";
|
|
3
2
|
import { addPluginFilter, filterPluginByFileId, getPluginName, isDuplicatePlugin } from "./helpers/filters.mjs";
|
|
4
3
|
import { resolveBabelPlugin, resolvePluginFunction } from "./helpers/options.mjs";
|
|
@@ -6,9 +5,9 @@ import { __ΩGenerateFromAstOptions, generateFromAst, parseAst } from "./helpers
|
|
|
6
5
|
import { createBabelPlugin } from "./helpers/create-plugin.mjs";
|
|
7
6
|
import { addImport, addImportsToProgram, findExport, getImport, isImportCall, listExports, listImports } from "./helpers/module-helpers.mjs";
|
|
8
7
|
import "./helpers/index.mjs";
|
|
8
|
+
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
9
9
|
import defu$1 from "defu";
|
|
10
10
|
import { transformAsync } from "@babel/core";
|
|
11
|
-
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
12
11
|
import { findFileExtension, findFileExtensionSafe } from "@stryke/path/file-path-fns";
|
|
13
12
|
import { isParentPath } from "@stryke/path/is-parent-path";
|
|
14
13
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
@@ -121,10 +120,8 @@ const plugin = __assignType((options = {}) => {
|
|
|
121
120
|
() => __ΩBabelPluginOptions,
|
|
122
121
|
"options",
|
|
123
122
|
() => ({}),
|
|
124
|
-
() => __ΩPlugin,
|
|
125
|
-
() => __ΩBabelPluginContext,
|
|
126
123
|
"",
|
|
127
|
-
"Pn!2\"
|
|
124
|
+
"Pn!2\">#\"/$"
|
|
128
125
|
]);
|
|
129
126
|
var src_default = plugin;
|
|
130
127
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import "./internal/helpers/hooks.mjs";
|
|
2
|
+
import "./types/api.mjs";
|
|
1
3
|
import "./types/hooks.mjs";
|
|
2
4
|
import "./types/context.mjs";
|
|
3
5
|
import "./types/config.mjs";
|
|
4
6
|
import "./types/resolved.mjs";
|
|
5
|
-
import "./internal/helpers/hooks.mjs";
|
|
6
|
-
import "./types/api.mjs";
|
|
7
7
|
import "./types/index.mjs";
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { ResolveOptions, StorageAdapter, StoragePort, StoragePreset, VirtualFile, VirtualFileData, VirtualFileMetadata, VirtualFileSystemInterface, WriteOptions } from "./types/fs.mjs";
|
|
2
|
-
import { BuildConfig, BuildResolvedConfig,
|
|
2
|
+
import { BuildConfig, BuildResolvedConfig, BuilderVariant, ESBuildBuildConfig, ESBuildResolvedBuildConfig, FarmBuildConfig, FarmResolvedBuildConfig, InferUnpluginVariant, RolldownBuildConfig, RolldownResolvedBuildConfig, RollupBuildConfig, RollupBuildOutputConfig, RollupResolvedBuildConfig, RspackBuildConfig, RspackResolvedBuildConfig, TsdownBuildConfig, TsdownResolvedBuildConfig, TsupBuildConfig, TsupResolvedBuildConfig, UnbuildBuildConfig, UnbuildResolvedBuildConfig, UnpluginBuilderVariant, ViteBuildConfig, ViteResolvedBuildConfig, WebpackBuildConfig, WebpackResolvedBuildConfig } from "./types/build.mjs";
|
|
3
3
|
import { CommandType, SUPPORTED_COMMANDS } from "./types/commands.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { API } from "./types/api.mjs";
|
|
5
|
+
import { InferUnpluginOptions, UnpluginOptions } from "./types/unplugin.mjs";
|
|
6
|
+
import { Plugin, PluginHook, PluginHookFields, PluginHookFunctions, PluginHookObject, PluginHooks, TypesResult } from "./types/plugin.mjs";
|
|
7
|
+
import { HookFields, HookListOrders, HooksList, InferHookFunction, InferHookParameters, InferHookReturnType, InferHooksListItem, PluginHooksList, PluginHooksListItem, UnpluginHookFunctions, UnpluginHookList, UnpluginHookVariant, UnpluginHookVariantField, UnpluginHooksListItem } from "./types/hooks.mjs";
|
|
5
8
|
import { DeepkitOptions, ParsedTypeScriptConfig, RawReflectionMode, ReflectionLevel, ReflectionMode, TSCompilerOptions, TSConfig } from "./types/tsconfig.mjs";
|
|
6
|
-
import { BuildPluginContext, Context, EmitEntryOptions, EmitOptions, FetchOptions, InitContextOptions, LogLevel, MetaInfo, ParseOptions, PluginContext, Resolver, TransformResult, UnresolvedContext } from "./types/context.mjs";
|
|
9
|
+
import { APIContext, BuildPluginContext, Context, EmitEntryOptions, EmitOptions, EnvironmentContext, EnvironmentContextPlugin, FetchOptions, InitContextOptions, LogLevel, MetaInfo, ParseOptions, PluginContext, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, TransformResult, UnresolvedContext, WithUnpluginBuildContext } from "./types/context.mjs";
|
|
7
10
|
import { BabelPluginPass, BabelTransformPlugin, BabelTransformPluginFilter, BabelTransformPluginOptions, DeclareBabelTransformPluginReturn } from "./types/babel.mjs";
|
|
8
|
-
import { BabelUserConfig, BaseConfig, CommonUserConfig, DeployConfig, EnvironmentConfig, InlineConfig, LogFn, OutputConfig, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PowerlinesCommand, ProjectType, UserConfig, WorkspaceConfig } from "./types/config.mjs";
|
|
9
|
-
import { BabelResolvedConfig, EnvironmentResolvedConfig, OutputResolvedConfig, ResolvedAssetGlob, ResolvedConfig, ResolvedEntryTypeDefinition } from "./types/resolved.mjs";
|
|
11
|
+
import { BabelUserConfig, BaseConfig, BuildInlineConfig, CleanInlineConfig, CommonUserConfig, DeployConfig, DeployInlineConfig, DocsInlineConfig, ESBuildUserConfig, EnvironmentConfig, FarmUserConfig, InlineConfig, LintInlineConfig, LogFn, NewInlineConfig, OutputConfig, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PowerlinesCommand, PrepareInlineConfig, ProjectType, RolldownUserConfig, RollupUserConfig, RspackUserConfig, TsdownUserConfig, TsupUserConfig, UnbuildUserConfig, UserConfig, ViteUserConfig, WebpackUserConfig, WorkspaceConfig } from "./types/config.mjs";
|
|
12
|
+
import { BabelResolvedConfig, ESBuildResolvedConfig, EnvironmentResolvedConfig, FarmResolvedConfig, InferResolvedConfig, OutputResolvedConfig, ResolvedAssetGlob, ResolvedConfig, ResolvedEntryTypeDefinition, RolldownResolvedConfig, RollupResolvedConfig, RspackResolvedConfig, TsdownResolvedConfig, TsupResolvedConfig, UnbuildResolvedConfig, ViteResolvedConfig, WebpackResolvedConfig } from "./types/resolved.mjs";
|
|
10
13
|
import "./types/index.mjs";
|
|
11
14
|
import "./api.mjs";
|
|
12
15
|
import "../schemas/fs.mjs";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_context = require('../../types/context.cjs');
|
|
3
3
|
const require_hooks = require('../../types/hooks.cjs');
|
|
4
|
-
let defu = require("defu");
|
|
5
4
|
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
6
5
|
let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
7
6
|
let __stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
|
|
@@ -9,6 +8,7 @@ let __stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
|
|
|
9
8
|
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
10
9
|
let chalk = require("chalk");
|
|
11
10
|
chalk = require_rolldown_runtime.__toESM(chalk);
|
|
11
|
+
let defu = require("defu");
|
|
12
12
|
|
|
13
13
|
//#region ../powerlines/src/internal/helpers/hooks.ts
|
|
14
14
|
function __assignType(fn, args) {
|
|
@@ -53,33 +53,51 @@ const mergeResults = (0, defu.createDefu)(__assignType((obj, key, value) => {
|
|
|
53
53
|
* Calls a hook with the given context, options, and arguments.
|
|
54
54
|
*
|
|
55
55
|
* @param context - The context to use when calling the hook.
|
|
56
|
-
* @param
|
|
56
|
+
* @param key - The hook to call.
|
|
57
57
|
* @param options - Options for calling the hook.
|
|
58
58
|
* @param args - Arguments to pass to the hook.
|
|
59
59
|
* @returns The return value of the hook.
|
|
60
60
|
*/
|
|
61
|
-
async function callHook(context,
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
context.log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, ` 🧩 Calling plugin hook: ${chalk.default.bold.cyanBright(`${
|
|
61
|
+
async function callHook(context, key, options, ...args) {
|
|
62
|
+
const hooks = context.selectHooks(key, options);
|
|
63
|
+
if (hooks.length > 0) {
|
|
64
|
+
context.log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, ` 🧩 Calling plugin hook: ${chalk.default.bold.cyanBright(`${key}${options?.order ? ` (${options.order})` : ""}`)}`);
|
|
65
|
+
const invokeHook = __assignType(async (hook, hookArgs) => {
|
|
66
|
+
return Reflect.apply(hook.handler, hook.context, hookArgs);
|
|
67
|
+
}, [
|
|
68
|
+
"hook",
|
|
69
|
+
() => require_hooks.__ΩInferHookParameters,
|
|
70
|
+
() => require_context.__ΩPluginContext,
|
|
71
|
+
() => context,
|
|
72
|
+
() => require_context.__ΩEnvironmentContext,
|
|
73
|
+
() => args,
|
|
74
|
+
() => require_hooks.__ΩInferHookParameters,
|
|
75
|
+
() => require_context.__ΩPluginContext,
|
|
76
|
+
() => args,
|
|
77
|
+
() => require_hooks.__ΩInferHookParameters,
|
|
78
|
+
() => require_context.__ΩPluginContext,
|
|
79
|
+
"hookArgs",
|
|
80
|
+
"",
|
|
81
|
+
"P!2!Pdi$h!!o%\"qe!!!jPdi&h!!o(\"\"o'#qe!!!jo#\"Pdi)\"o+\"h!!o*#qe!!!jo\"#2,\"/-"
|
|
82
|
+
]);
|
|
65
83
|
let results = [];
|
|
66
|
-
if (options?.sequential === false) results = await Promise.all(
|
|
67
|
-
if (!(0, __stryke_type_checks_is_function.isFunction)(handler
|
|
68
|
-
return
|
|
84
|
+
if (options?.sequential === false) results = await Promise.all(hooks.map(__assignType(async (hook) => {
|
|
85
|
+
if (!(0, __stryke_type_checks_is_function.isFunction)(hook.handler)) throw new Error(`Plugin hook handler for hook "${key}" is not a function.`);
|
|
86
|
+
return invokeHook(hook, [...args]);
|
|
69
87
|
}, [
|
|
70
|
-
"
|
|
88
|
+
"hook",
|
|
71
89
|
"",
|
|
72
90
|
"P\"2!\"/\""
|
|
73
91
|
])));
|
|
74
|
-
else for (const
|
|
75
|
-
if (!(0, __stryke_type_checks_is_function.isFunction)(handler
|
|
92
|
+
else for (const hook of hooks) {
|
|
93
|
+
if (!(0, __stryke_type_checks_is_function.isFunction)(hook.handler)) throw new Error(`Plugin hook handler for hook "${key}" is not a function.`);
|
|
76
94
|
if (options?.result === "first" || options?.asNextParam === false) {
|
|
77
|
-
results.push(await Promise.resolve(
|
|
95
|
+
results.push(await Promise.resolve(invokeHook(hook, [...args])));
|
|
78
96
|
if (options?.result === "first" && (0, __stryke_type_checks_is_set.isSet)(results[results.length - 1])) break;
|
|
79
97
|
} else {
|
|
80
98
|
const sequenceArgs = [...args];
|
|
81
99
|
if (results.length > 0 && sequenceArgs.length > 0) sequenceArgs[0] = (0, __stryke_type_checks_is_function.isFunction)(options.asNextParam) ? await Promise.resolve(options.asNextParam(results[0])) : results[0];
|
|
82
|
-
const result = await Promise.resolve(
|
|
100
|
+
const result = await Promise.resolve(invokeHook(hook, [...sequenceArgs]));
|
|
83
101
|
if (result) {
|
|
84
102
|
if (options?.result === "last") results = [result];
|
|
85
103
|
else if ((0, __stryke_type_checks_is_string.isString)(result)) results = [`${(0, __stryke_type_checks_is_string.isString)(results[0]) ? results[0] || "" : ""}\n${result || ""}`.trim()];
|
|
@@ -100,20 +118,20 @@ async function callHook(context, hook, options, ...args) {
|
|
|
100
118
|
}
|
|
101
119
|
}
|
|
102
120
|
callHook.__type = [
|
|
121
|
+
() => require_context.__ΩEnvironmentContext,
|
|
103
122
|
"context",
|
|
104
|
-
"
|
|
123
|
+
"key",
|
|
105
124
|
() => __ΩCallHookOptions,
|
|
106
125
|
"options",
|
|
107
126
|
() => require_hooks.__ΩInferHookParameters,
|
|
108
127
|
() => require_context.__ΩPluginContext,
|
|
109
|
-
"config",
|
|
110
128
|
"args",
|
|
111
129
|
() => require_hooks.__ΩInferHookReturnType,
|
|
112
130
|
() => require_context.__ΩPluginContext,
|
|
113
|
-
"config",
|
|
114
131
|
"callHook",
|
|
115
132
|
"Calls a hook with the given context, options, and arguments.",
|
|
116
|
-
"P\"
|
|
133
|
+
"P\"o!\"2\"\"2#n$2%\"o'\"\"o&#@2(P\"o*\"\"o)#-J`/+?,"
|
|
117
134
|
];
|
|
118
135
|
|
|
119
|
-
//#endregion
|
|
136
|
+
//#endregion
|
|
137
|
+
exports.__ΩCallHookOptions = __ΩCallHookOptions;
|