@powerlines/plugin-esbuild 0.13.307 → 0.13.308
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/build-Br4iCJ5d.d.cts +8 -0
- package/dist/build-Br4iCJ5d.d.cts.map +1 -0
- package/dist/build-CQpSv6Qa.cjs +0 -0
- package/dist/build-CrohITJo.d.mts +8 -0
- package/dist/build-CrohITJo.d.mts.map +1 -0
- package/dist/build-DfzG3fLI.mjs +1 -0
- package/dist/bundle-Bx7Mimeh.d.cts +17 -0
- package/dist/bundle-Bx7Mimeh.d.cts.map +1 -0
- package/dist/bundle-D6QqCoyO.mjs +41 -0
- package/dist/bundle-D6QqCoyO.mjs.map +1 -0
- package/dist/bundle-DG12gVtZ.cjs +46 -0
- package/dist/bundle-UTFhPSjU.d.mts +17 -0
- package/dist/bundle-UTFhPSjU.d.mts.map +1 -0
- package/dist/helpers/bundle.cjs +3 -42
- package/dist/helpers/bundle.d.cts +2 -17
- package/dist/helpers/bundle.d.mts +2 -17
- package/dist/helpers/bundle.mjs +3 -41
- package/dist/helpers/index.cjs +12 -11
- package/dist/helpers/index.d.cts +7 -4
- package/dist/helpers/index.d.mts +7 -4
- package/dist/helpers/index.mjs +5 -4
- package/dist/helpers/resolve-options.cjs +4 -89
- package/dist/helpers/resolve-options.d.cts +2 -24
- package/dist/helpers/resolve-options.d.mts +2 -25
- package/dist/helpers/resolve-options.mjs +2 -86
- package/dist/helpers/resolve.cjs +3 -62
- package/dist/helpers/resolve.d.cts +2 -27
- package/dist/helpers/resolve.d.mts +2 -28
- package/dist/helpers/resolve.mjs +2 -61
- package/dist/helpers/unplugin.cjs +2 -11
- package/dist/helpers/unplugin.d.cts +4 -8
- package/dist/helpers/unplugin.d.mts +4 -8
- package/dist/helpers/unplugin.mjs +2 -11
- package/dist/helpers-BAUlPOQe.mjs +1 -0
- package/dist/helpers-CAF8Bmv1.cjs +0 -0
- package/dist/index-ClXLQ1fw.d.mts +1 -0
- package/dist/index-DJOHDG5e.d.mts +1 -0
- package/dist/index-DeEmP3Jc.d.cts +1 -0
- package/dist/index-sQecLSpR.d.cts +1 -0
- package/dist/index.cjs +20 -18
- package/dist/index.d.cts +9 -7
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +9 -10
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +8 -5
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-BL8TLixo.mjs +1 -0
- package/dist/plugin-Bivts13R.d.mts +19 -0
- package/dist/plugin-Bivts13R.d.mts.map +1 -0
- package/dist/plugin-OjUZLLkc.cjs +0 -0
- package/dist/plugin-fp0p1CCy.d.cts +19 -0
- package/dist/plugin-fp0p1CCy.d.cts.map +1 -0
- package/dist/resolve-BU3nddJ7.d.mts +27 -0
- package/dist/resolve-BU3nddJ7.d.mts.map +1 -0
- package/dist/resolve-BUiEAXVB.d.cts +27 -0
- package/dist/resolve-BUiEAXVB.d.cts.map +1 -0
- package/dist/resolve-C8OzoP-s.mjs +62 -0
- package/dist/resolve-C8OzoP-s.mjs.map +1 -0
- package/dist/resolve-CsStIaEj.cjs +73 -0
- package/dist/resolve-options-C-213jz6.mjs +87 -0
- package/dist/resolve-options-C-213jz6.mjs.map +1 -0
- package/dist/resolve-options-C3WIGKaG.cjs +137 -0
- package/dist/resolve-options-CpEoapmL.d.mts +23 -0
- package/dist/resolve-options-CpEoapmL.d.mts.map +1 -0
- package/dist/resolve-options-DSHX7AUS.d.cts +23 -0
- package/dist/resolve-options-DSHX7AUS.d.cts.map +1 -0
- package/dist/types/build.cjs +1 -0
- package/dist/types/build.d.cts +2 -8
- package/dist/types/build.d.mts +2 -8
- package/dist/types/build.mjs +2 -0
- package/dist/types/index.cjs +3 -0
- package/dist/types/index.d.cts +3 -2
- package/dist/types/index.d.mts +3 -2
- package/dist/types/index.mjs +4 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +3 -20
- package/dist/types/plugin.d.mts +3 -21
- package/dist/types/plugin.mjs +2 -0
- package/dist/types-CvhspRRt.mjs +1 -0
- package/dist/types-DdloOYgD.cjs +0 -0
- package/dist/unplugin-CW_BVHFj.cjs +16 -0
- package/dist/unplugin-Cf7hyWQE.d.cts +8 -0
- package/dist/unplugin-Cf7hyWQE.d.cts.map +1 -0
- package/dist/unplugin-Csi4d8gj.d.mts +8 -0
- package/dist/unplugin-Csi4d8gj.d.mts.map +1 -0
- package/dist/unplugin-_Yvl6iM8.mjs +11 -0
- package/dist/unplugin-_Yvl6iM8.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/_virtual/rolldown_runtime.cjs +0 -29
- package/dist/core/src/lib/entry.cjs +0 -22
- package/dist/core/src/lib/entry.mjs +0 -22
- package/dist/core/src/lib/entry.mjs.map +0 -1
- package/dist/core/src/lib/logger.cjs +0 -41
- package/dist/core/src/lib/logger.mjs +0 -40
- package/dist/core/src/lib/logger.mjs.map +0 -1
- package/dist/core/src/lib/unplugin/helpers.cjs +0 -19
- package/dist/core/src/lib/unplugin/helpers.mjs +0 -19
- package/dist/core/src/lib/unplugin/helpers.mjs.map +0 -1
- package/dist/core/src/lib/unplugin/index.cjs +0 -3
- package/dist/core/src/lib/unplugin/index.mjs +0 -5
- package/dist/core/src/lib/unplugin/module-resolution.cjs +0 -66
- package/dist/core/src/lib/unplugin/module-resolution.mjs +0 -66
- package/dist/core/src/lib/unplugin/module-resolution.mjs.map +0 -1
- package/dist/core/src/lib/unplugin/plugin.cjs +0 -104
- package/dist/core/src/lib/unplugin/plugin.mjs +0 -103
- package/dist/core/src/lib/unplugin/plugin.mjs.map +0 -1
- package/dist/core/src/lib/utilities/source-file.cjs +0 -22
- package/dist/core/src/lib/utilities/source-file.mjs +0 -21
- package/dist/core/src/lib/utilities/source-file.mjs.map +0 -1
- package/dist/core/src/plugin-utils/paths.cjs +0 -2
- package/dist/core/src/plugin-utils/paths.mjs +0 -4
- package/dist/core/src/types/api.d.cts +0 -103
- package/dist/core/src/types/api.d.cts.map +0 -1
- package/dist/core/src/types/api.d.mts +0 -103
- package/dist/core/src/types/api.d.mts.map +0 -1
- package/dist/core/src/types/commands.d.cts +0 -9
- package/dist/core/src/types/commands.d.cts.map +0 -1
- package/dist/core/src/types/commands.d.mts +0 -10
- package/dist/core/src/types/commands.d.mts.map +0 -1
- package/dist/core/src/types/config.d.cts +0 -551
- package/dist/core/src/types/config.d.cts.map +0 -1
- package/dist/core/src/types/config.d.mts +0 -551
- package/dist/core/src/types/config.d.mts.map +0 -1
- package/dist/core/src/types/context.d.cts +0 -511
- package/dist/core/src/types/context.d.cts.map +0 -1
- package/dist/core/src/types/context.d.mts +0 -511
- package/dist/core/src/types/context.d.mts.map +0 -1
- package/dist/core/src/types/fs.d.cts +0 -487
- package/dist/core/src/types/fs.d.cts.map +0 -1
- package/dist/core/src/types/fs.d.mts +0 -487
- package/dist/core/src/types/fs.d.mts.map +0 -1
- package/dist/core/src/types/hooks.d.cts +0 -99
- package/dist/core/src/types/hooks.d.cts.map +0 -1
- package/dist/core/src/types/hooks.d.mts +0 -99
- package/dist/core/src/types/hooks.d.mts.map +0 -1
- package/dist/core/src/types/index.d.mts +0 -9
- package/dist/core/src/types/plugin.d.cts +0 -204
- package/dist/core/src/types/plugin.d.cts.map +0 -1
- package/dist/core/src/types/plugin.d.mts +0 -204
- package/dist/core/src/types/plugin.d.mts.map +0 -1
- package/dist/core/src/types/tsconfig.d.cts +0 -70
- package/dist/core/src/types/tsconfig.d.cts.map +0 -1
- package/dist/core/src/types/tsconfig.d.mts +0 -70
- package/dist/core/src/types/tsconfig.d.mts.map +0 -1
- package/dist/core/src/types/unplugin.cjs +0 -21
- package/dist/core/src/types/unplugin.d.cts +0 -24
- package/dist/core/src/types/unplugin.d.cts.map +0 -1
- package/dist/core/src/types/unplugin.d.mts +0 -25
- package/dist/core/src/types/unplugin.d.mts.map +0 -1
- package/dist/core/src/types/unplugin.mjs +0 -22
- package/dist/core/src/types/unplugin.mjs.map +0 -1
- package/dist/helpers/bundle.d.cts.map +0 -1
- package/dist/helpers/bundle.d.mts.map +0 -1
- package/dist/helpers/bundle.mjs.map +0 -1
- package/dist/helpers/resolve-options.d.cts.map +0 -1
- package/dist/helpers/resolve-options.d.mts.map +0 -1
- package/dist/helpers/resolve-options.mjs.map +0 -1
- package/dist/helpers/resolve.d.cts.map +0 -1
- package/dist/helpers/resolve.d.mts.map +0 -1
- package/dist/helpers/resolve.mjs.map +0 -1
- package/dist/helpers/unplugin.d.cts.map +0 -1
- package/dist/helpers/unplugin.d.mts.map +0 -1
- package/dist/helpers/unplugin.mjs.map +0 -1
- package/dist/types/build.d.cts.map +0 -1
- package/dist/types/build.d.mts.map +0 -1
- package/dist/types/plugin.d.cts.map +0 -1
- package/dist/types/plugin.d.mts.map +0 -1
package/dist/helpers/resolve.cjs
CHANGED
|
@@ -1,63 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_helpers_bundle = require('./bundle.cjs');
|
|
3
|
-
let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
|
|
4
|
-
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
1
|
+
const require_resolve = require('../resolve-CsStIaEj.cjs');
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* Compiles a type definition to a module and returns the module.
|
|
9
|
-
*
|
|
10
|
-
* @param context - The context object containing the environment paths.
|
|
11
|
-
* @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
|
|
12
|
-
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
13
|
-
* @returns A promise that resolves to the compiled module.
|
|
14
|
-
*/
|
|
15
|
-
async function resolveModule(context, type, overrides = {}) {
|
|
16
|
-
let typeDefinition;
|
|
17
|
-
if ((0, __stryke_type_checks_is_set_string.isSetString)(type)) typeDefinition = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(type);
|
|
18
|
-
else typeDefinition = type;
|
|
19
|
-
const result = await require_helpers_bundle.bundle(context, typeDefinition.file, overrides);
|
|
20
|
-
let resolved;
|
|
21
|
-
try {
|
|
22
|
-
resolved = await context.resolver.evalModule(result.text, {
|
|
23
|
-
filename: result.path,
|
|
24
|
-
forceTranspile: true
|
|
25
|
-
});
|
|
26
|
-
} catch (error) {
|
|
27
|
-
if ((0, __stryke_type_checks_is_set_string.isSetString)(error.message) && (/* @__PURE__ */ new RegExp(`Cannot find module '${context.config.framework || "powerlines"}:.*'`)).test(error.message)) {
|
|
28
|
-
const moduleName = error.message.match(/* @__PURE__ */ new RegExp(`Cannot find module '(${context.config.framework || "powerlines"}:.*)'`))?.[1];
|
|
29
|
-
throw new Error(`The module "${moduleName}" could not be resolved while evaluating "${typeDefinition.file}". It is possible the required built-in modules have not yet been generated. Please check the order of your plugins. ${context.config.logLevel === "debug" || context.config.logLevel === "trace" ? `
|
|
30
|
-
|
|
31
|
-
Bundle output for module:
|
|
32
|
-
${result.text}` : ""}`);
|
|
33
|
-
}
|
|
34
|
-
throw new Error(`Failed to evaluate the bundled module for "${typeDefinition.file}". Error: ${error.message}${context.config.logLevel === "debug" || context.config.logLevel === "trace" ? `
|
|
35
|
-
|
|
36
|
-
Bundle output for module:
|
|
37
|
-
${result.text}` : ""}`);
|
|
38
|
-
}
|
|
39
|
-
return resolved;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Compiles a type definition to a module and returns the specified export from the module.
|
|
43
|
-
*
|
|
44
|
-
* @param context - The context object containing the environment paths.
|
|
45
|
-
* @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
|
|
46
|
-
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
47
|
-
* @returns A promise that resolves to the compiled module.
|
|
48
|
-
*/
|
|
49
|
-
async function resolve(context, type, overrides = {}) {
|
|
50
|
-
let typeDefinition;
|
|
51
|
-
if ((0, __stryke_type_checks_is_set_string.isSetString)(type)) typeDefinition = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(type);
|
|
52
|
-
else typeDefinition = type;
|
|
53
|
-
const resolved = await resolveModule(context, typeDefinition, overrides);
|
|
54
|
-
let exportName = typeDefinition.name;
|
|
55
|
-
if (!exportName) exportName = "default";
|
|
56
|
-
const resolvedExport = resolved[exportName] ?? resolved[`__Ω${exportName}`];
|
|
57
|
-
if (resolvedExport === void 0) throw new Error(`The export "${exportName}" could not be resolved in the "${typeDefinition.file}" module. ${Object.keys(resolved).length === 0 ? `After bundling, no exports were found in the module. Please ensure that the "${typeDefinition.file}" module has a "${exportName}" export with the desired value.` : `After bundling, the available exports were: ${Object.keys(resolved).join(", ")}. Please ensure that the export exists and is correctly named.`}`);
|
|
58
|
-
return resolvedExport;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
//#endregion
|
|
62
|
-
exports.resolve = resolve;
|
|
63
|
-
exports.resolveModule = resolveModule;
|
|
3
|
+
exports.resolve = require_resolve.resolve;
|
|
4
|
+
exports.resolveModule = require_resolve.resolveModule;
|
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { BuildOptions } from "esbuild";
|
|
4
|
-
|
|
5
|
-
//#region src/helpers/resolve.d.ts
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Compiles a type definition to a module and returns the module.
|
|
9
|
-
*
|
|
10
|
-
* @param context - The context object containing the environment paths.
|
|
11
|
-
* @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
|
|
12
|
-
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
13
|
-
* @returns A promise that resolves to the compiled module.
|
|
14
|
-
*/
|
|
15
|
-
declare function resolveModule<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?: Partial<BuildOptions>): Promise<TResult>;
|
|
16
|
-
/**
|
|
17
|
-
* Compiles a type definition to a module and returns the specified export from the module.
|
|
18
|
-
*
|
|
19
|
-
* @param context - The context object containing the environment paths.
|
|
20
|
-
* @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
|
|
21
|
-
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
22
|
-
* @returns A promise that resolves to the compiled module.
|
|
23
|
-
*/
|
|
24
|
-
declare function resolve<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?: Partial<BuildOptions>): Promise<TResult>;
|
|
25
|
-
//#endregion
|
|
26
|
-
export { resolve, resolveModule };
|
|
27
|
-
//# sourceMappingURL=resolve.d.cts.map
|
|
1
|
+
import { n as resolveModule, t as resolve } from "../resolve-BUiEAXVB.cjs";
|
|
2
|
+
export { resolve, resolveModule };
|
|
@@ -1,28 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { BuildOptions } from "esbuild";
|
|
4
|
-
import { TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
5
|
-
|
|
6
|
-
//#region src/helpers/resolve.d.ts
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Compiles a type definition to a module and returns the module.
|
|
10
|
-
*
|
|
11
|
-
* @param context - The context object containing the environment paths.
|
|
12
|
-
* @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
|
|
13
|
-
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
14
|
-
* @returns A promise that resolves to the compiled module.
|
|
15
|
-
*/
|
|
16
|
-
declare function resolveModule<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?: Partial<BuildOptions>): Promise<TResult>;
|
|
17
|
-
/**
|
|
18
|
-
* Compiles a type definition to a module and returns the specified export from the module.
|
|
19
|
-
*
|
|
20
|
-
* @param context - The context object containing the environment paths.
|
|
21
|
-
* @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
|
|
22
|
-
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
23
|
-
* @returns A promise that resolves to the compiled module.
|
|
24
|
-
*/
|
|
25
|
-
declare function resolve<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?: Partial<BuildOptions>): Promise<TResult>;
|
|
26
|
-
//#endregion
|
|
27
|
-
export { resolve, resolveModule };
|
|
28
|
-
//# sourceMappingURL=resolve.d.mts.map
|
|
1
|
+
import { n as resolveModule, t as resolve } from "../resolve-BU3nddJ7.mjs";
|
|
2
|
+
export { resolve, resolveModule };
|
package/dist/helpers/resolve.mjs
CHANGED
|
@@ -1,62 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
|
|
3
|
-
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
1
|
+
import { n as resolveModule, t as resolve } from "../resolve-C8OzoP-s.mjs";
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Compiles a type definition to a module and returns the module.
|
|
8
|
-
*
|
|
9
|
-
* @param context - The context object containing the environment paths.
|
|
10
|
-
* @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
|
|
11
|
-
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
12
|
-
* @returns A promise that resolves to the compiled module.
|
|
13
|
-
*/
|
|
14
|
-
async function resolveModule(context, type, overrides = {}) {
|
|
15
|
-
let typeDefinition;
|
|
16
|
-
if (isSetString(type)) typeDefinition = parseTypeDefinition(type);
|
|
17
|
-
else typeDefinition = type;
|
|
18
|
-
const result = await bundle(context, typeDefinition.file, overrides);
|
|
19
|
-
let resolved;
|
|
20
|
-
try {
|
|
21
|
-
resolved = await context.resolver.evalModule(result.text, {
|
|
22
|
-
filename: result.path,
|
|
23
|
-
forceTranspile: true
|
|
24
|
-
});
|
|
25
|
-
} catch (error) {
|
|
26
|
-
if (isSetString(error.message) && (/* @__PURE__ */ new RegExp(`Cannot find module '${context.config.framework || "powerlines"}:.*'`)).test(error.message)) {
|
|
27
|
-
const moduleName = error.message.match(/* @__PURE__ */ new RegExp(`Cannot find module '(${context.config.framework || "powerlines"}:.*)'`))?.[1];
|
|
28
|
-
throw new Error(`The module "${moduleName}" could not be resolved while evaluating "${typeDefinition.file}". It is possible the required built-in modules have not yet been generated. Please check the order of your plugins. ${context.config.logLevel === "debug" || context.config.logLevel === "trace" ? `
|
|
29
|
-
|
|
30
|
-
Bundle output for module:
|
|
31
|
-
${result.text}` : ""}`);
|
|
32
|
-
}
|
|
33
|
-
throw new Error(`Failed to evaluate the bundled module for "${typeDefinition.file}". Error: ${error.message}${context.config.logLevel === "debug" || context.config.logLevel === "trace" ? `
|
|
34
|
-
|
|
35
|
-
Bundle output for module:
|
|
36
|
-
${result.text}` : ""}`);
|
|
37
|
-
}
|
|
38
|
-
return resolved;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Compiles a type definition to a module and returns the specified export from the module.
|
|
42
|
-
*
|
|
43
|
-
* @param context - The context object containing the environment paths.
|
|
44
|
-
* @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
|
|
45
|
-
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
46
|
-
* @returns A promise that resolves to the compiled module.
|
|
47
|
-
*/
|
|
48
|
-
async function resolve(context, type, overrides = {}) {
|
|
49
|
-
let typeDefinition;
|
|
50
|
-
if (isSetString(type)) typeDefinition = parseTypeDefinition(type);
|
|
51
|
-
else typeDefinition = type;
|
|
52
|
-
const resolved = await resolveModule(context, typeDefinition, overrides);
|
|
53
|
-
let exportName = typeDefinition.name;
|
|
54
|
-
if (!exportName) exportName = "default";
|
|
55
|
-
const resolvedExport = resolved[exportName] ?? resolved[`__Ω${exportName}`];
|
|
56
|
-
if (resolvedExport === void 0) throw new Error(`The export "${exportName}" could not be resolved in the "${typeDefinition.file}" module. ${Object.keys(resolved).length === 0 ? `After bundling, no exports were found in the module. Please ensure that the "${typeDefinition.file}" module has a "${exportName}" export with the desired value.` : `After bundling, the available exports were: ${Object.keys(resolved).join(", ")}. Please ensure that the export exists and is correctly named.`}`);
|
|
57
|
-
return resolvedExport;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
//#endregion
|
|
61
|
-
export { resolve, resolveModule };
|
|
62
|
-
//# sourceMappingURL=resolve.mjs.map
|
|
3
|
+
export { resolve, resolveModule };
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_plugin = require('../core/src/lib/unplugin/plugin.cjs');
|
|
3
|
-
require('../core/src/lib/unplugin/index.cjs');
|
|
4
|
-
let unplugin = require("unplugin");
|
|
1
|
+
const require_unplugin = require('../unplugin-CW_BVHFj.cjs');
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
function createEsbuildPlugin(context) {
|
|
8
|
-
return (0, unplugin.createEsbuildPlugin)(require_plugin.createUnplugin(context))({});
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
|
-
exports.createEsbuildPlugin = createEsbuildPlugin;
|
|
3
|
+
exports.createEsbuildPlugin = require_unplugin.createEsbuildPlugin;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare function createEsbuildPlugin(context: EsbuildPluginContext): esbuild0.Plugin;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { createEsbuildPlugin };
|
|
8
|
-
//# sourceMappingURL=unplugin.d.cts.map
|
|
1
|
+
import "../build-Br4iCJ5d.cjs";
|
|
2
|
+
import "../plugin-fp0p1CCy.cjs";
|
|
3
|
+
import { t as createEsbuildPlugin } from "../unplugin-Cf7hyWQE.cjs";
|
|
4
|
+
export { createEsbuildPlugin };
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare function createEsbuildPlugin(context: EsbuildPluginContext): esbuild0.Plugin;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { createEsbuildPlugin };
|
|
8
|
-
//# sourceMappingURL=unplugin.d.mts.map
|
|
1
|
+
import "../build-CrohITJo.mjs";
|
|
2
|
+
import "../plugin-Bivts13R.mjs";
|
|
3
|
+
import { t as createEsbuildPlugin } from "../unplugin-Csi4d8gj.mjs";
|
|
4
|
+
export { createEsbuildPlugin };
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../core/src/lib/unplugin/index.mjs";
|
|
3
|
-
import { createEsbuildPlugin as createEsbuildPlugin$1 } from "unplugin";
|
|
1
|
+
import { t as createEsbuildPlugin } from "../unplugin-_Yvl6iM8.mjs";
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
function createEsbuildPlugin(context) {
|
|
7
|
-
return createEsbuildPlugin$1(createUnplugin(context))({});
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
|
-
export { createEsbuildPlugin };
|
|
12
|
-
//# sourceMappingURL=unplugin.mjs.map
|
|
3
|
+
export { createEsbuildPlugin };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
require('./
|
|
2
|
+
const require_resolve_options = require('./resolve-options-C3WIGKaG.cjs');
|
|
3
|
+
const require_unplugin = require('./unplugin-CW_BVHFj.cjs');
|
|
4
|
+
const require_bundle = require('./bundle-DG12gVtZ.cjs');
|
|
5
|
+
const require_resolve = require('./resolve-CsStIaEj.cjs');
|
|
6
|
+
require('./helpers-CAF8Bmv1.cjs');
|
|
7
|
+
require('./build-CQpSv6Qa.cjs');
|
|
8
|
+
require('./plugin-OjUZLLkc.cjs');
|
|
9
|
+
require('./types-DdloOYgD.cjs');
|
|
8
10
|
let defu = require("defu");
|
|
9
|
-
defu =
|
|
11
|
+
defu = require_resolve_options.__toESM(defu);
|
|
10
12
|
let esbuild = require("esbuild");
|
|
11
13
|
|
|
12
14
|
//#region src/index.ts
|
|
@@ -20,7 +22,7 @@ const plugin = (options = {}) => {
|
|
|
20
22
|
return {
|
|
21
23
|
output: { format: ["esm"] },
|
|
22
24
|
build: {
|
|
23
|
-
...
|
|
25
|
+
...require_resolve_options.DEFAULT_ESBUILD_CONFIG,
|
|
24
26
|
...options,
|
|
25
27
|
variant: "esbuild"
|
|
26
28
|
}
|
|
@@ -28,21 +30,21 @@ const plugin = (options = {}) => {
|
|
|
28
30
|
},
|
|
29
31
|
async build() {
|
|
30
32
|
await (0, esbuild.build)((0, defu.default)({
|
|
31
|
-
entryPoints:
|
|
32
|
-
plugins: [
|
|
33
|
-
},
|
|
33
|
+
entryPoints: require_resolve_options.resolveEntry(this, this.entry),
|
|
34
|
+
plugins: [require_unplugin.createEsbuildPlugin(this)]
|
|
35
|
+
}, require_resolve_options.resolveOptions(this)));
|
|
34
36
|
}
|
|
35
37
|
};
|
|
36
38
|
};
|
|
37
39
|
var src_default = plugin;
|
|
38
40
|
|
|
39
41
|
//#endregion
|
|
40
|
-
exports.DEFAULT_ESBUILD_CONFIG =
|
|
41
|
-
exports.bundle =
|
|
42
|
-
exports.createEsbuildPlugin =
|
|
42
|
+
exports.DEFAULT_ESBUILD_CONFIG = require_resolve_options.DEFAULT_ESBUILD_CONFIG;
|
|
43
|
+
exports.bundle = require_bundle.bundle;
|
|
44
|
+
exports.createEsbuildPlugin = require_unplugin.createEsbuildPlugin;
|
|
43
45
|
exports.default = src_default;
|
|
44
46
|
exports.plugin = plugin;
|
|
45
|
-
exports.resolve =
|
|
46
|
-
exports.resolveEntry =
|
|
47
|
-
exports.resolveModule =
|
|
48
|
-
exports.resolveOptions =
|
|
47
|
+
exports.resolve = require_resolve.resolve;
|
|
48
|
+
exports.resolveEntry = require_resolve_options.resolveEntry;
|
|
49
|
+
exports.resolveModule = require_resolve.resolveModule;
|
|
50
|
+
exports.resolveOptions = require_resolve_options.resolveOptions;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
1
|
+
import { t as bundle } from "./bundle-Bx7Mimeh.cjs";
|
|
2
|
+
import { n as resolveModule, t as resolve } from "./resolve-BUiEAXVB.cjs";
|
|
3
|
+
import { n as resolveEntry, r as resolveOptions, t as DEFAULT_ESBUILD_CONFIG } from "./resolve-options-DSHX7AUS.cjs";
|
|
4
|
+
import { n as __ΩEsbuildOptions, t as EsbuildOptions } from "./build-Br4iCJ5d.cjs";
|
|
5
|
+
import { a as __ΩEsbuildPluginContext, c as __ΩEsbuildPluginUserConfig, i as EsbuildPluginUserConfig, n as EsbuildPluginOptions, o as __ΩEsbuildPluginOptions, r as EsbuildPluginResolvedConfig, s as __ΩEsbuildPluginResolvedConfig, t as EsbuildPluginContext } from "./plugin-fp0p1CCy.cjs";
|
|
6
|
+
import { t as createEsbuildPlugin } from "./unplugin-Cf7hyWQE.cjs";
|
|
7
|
+
import "./index-DeEmP3Jc.cjs";
|
|
8
|
+
import "./index-sQecLSpR.cjs";
|
|
9
|
+
import { Plugin } from "@powerlines/core/types";
|
|
8
10
|
|
|
9
11
|
//#region src/index.d.ts
|
|
10
12
|
/**
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;cAuCa,0BACM,uBAAuB,gCAE/B,yBACR,OAAO"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "./
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import "
|
|
10
|
-
import "./types/index.mjs";
|
|
1
|
+
import { t as bundle } from "./bundle-UTFhPSjU.mjs";
|
|
2
|
+
import { n as resolveModule, t as resolve } from "./resolve-BU3nddJ7.mjs";
|
|
3
|
+
import { n as resolveEntry, r as resolveOptions, t as DEFAULT_ESBUILD_CONFIG } from "./resolve-options-CpEoapmL.mjs";
|
|
4
|
+
import { n as __ΩEsbuildOptions, t as EsbuildOptions } from "./build-CrohITJo.mjs";
|
|
5
|
+
import { a as __ΩEsbuildPluginContext, c as __ΩEsbuildPluginUserConfig, i as EsbuildPluginUserConfig, n as EsbuildPluginOptions, o as __ΩEsbuildPluginOptions, r as EsbuildPluginResolvedConfig, s as __ΩEsbuildPluginResolvedConfig, t as EsbuildPluginContext } from "./plugin-Bivts13R.mjs";
|
|
6
|
+
import { t as createEsbuildPlugin } from "./unplugin-Csi4d8gj.mjs";
|
|
7
|
+
import "./index-ClXLQ1fw.mjs";
|
|
8
|
+
import "./index-DJOHDG5e.mjs";
|
|
9
|
+
import { Plugin } from "@powerlines/core/types";
|
|
11
10
|
|
|
12
11
|
//#region src/index.d.ts
|
|
13
12
|
/**
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;cAuCa,0BACM,uBAAuB,gCAE/B,yBACR,OAAO"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createEsbuildPlugin } from "./
|
|
3
|
-
import { bundle } from "./
|
|
4
|
-
import {
|
|
5
|
-
import "./helpers
|
|
1
|
+
import { n as resolveEntry, r as resolveOptions, t as DEFAULT_ESBUILD_CONFIG } from "./resolve-options-C-213jz6.mjs";
|
|
2
|
+
import { t as createEsbuildPlugin } from "./unplugin-_Yvl6iM8.mjs";
|
|
3
|
+
import { t as bundle } from "./bundle-D6QqCoyO.mjs";
|
|
4
|
+
import { n as resolveModule, t as resolve } from "./resolve-C8OzoP-s.mjs";
|
|
5
|
+
import "./helpers-BAUlPOQe.mjs";
|
|
6
|
+
import "./build-DfzG3fLI.mjs";
|
|
7
|
+
import "./plugin-BL8TLixo.mjs";
|
|
8
|
+
import "./types-CvhspRRt.mjs";
|
|
6
9
|
import defu from "defu";
|
|
7
10
|
import { build } from "esbuild";
|
|
8
11
|
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Plugin } from \"@powerlines/core/types\";\nimport defu from \"defu\";\nimport { build } from \"esbuild\";\nimport {\n DEFAULT_ESBUILD_CONFIG,\n resolveEntry,\n resolveOptions\n} from \"./helpers/resolve-options\";\nimport { createEsbuildPlugin } from \"./helpers/unplugin\";\nimport {\n EsbuildPluginContext,\n EsbuildPluginOptions,\n EsbuildPluginUserConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport const plugin = <\n TContext extends EsbuildPluginContext = EsbuildPluginContext\n>(\n options: EsbuildPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"esbuild\",\n config() {\n return {\n output: {\n format: [\"esm\"]\n },\n build: {\n ...DEFAULT_ESBUILD_CONFIG,\n ...options,\n variant: \"esbuild\"\n }\n } as Partial<EsbuildPluginUserConfig>;\n },\n async build() {\n await build(\n defu(\n {\n entryPoints: resolveEntry(this, this.entry),\n plugins: [createEsbuildPlugin(this)]\n },\n resolveOptions(this)\n )\n );\n }\n };\n};\n\nexport default plugin;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Plugin } from \"@powerlines/core/types\";\nimport defu from \"defu\";\nimport { build } from \"esbuild\";\nimport {\n DEFAULT_ESBUILD_CONFIG,\n resolveEntry,\n resolveOptions\n} from \"./helpers/resolve-options\";\nimport { createEsbuildPlugin } from \"./helpers/unplugin\";\nimport {\n EsbuildPluginContext,\n EsbuildPluginOptions,\n EsbuildPluginUserConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport const plugin = <\n TContext extends EsbuildPluginContext = EsbuildPluginContext\n>(\n options: EsbuildPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"esbuild\",\n config() {\n return {\n output: {\n format: [\"esm\"]\n },\n build: {\n ...DEFAULT_ESBUILD_CONFIG,\n ...options,\n variant: \"esbuild\"\n }\n } as Partial<EsbuildPluginUserConfig>;\n },\n async build() {\n await build(\n defu(\n {\n entryPoints: resolveEntry(this, this.entry),\n plugins: [createEsbuildPlugin(this)]\n },\n resolveOptions(this)\n )\n );\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;AAuCA,MAAa,UAGX,UAAgC,EAAE,KACb;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO;IACL,QAAQ,EACN,QAAQ,CAAC,MAAM,EAChB;IACD,OAAO;KACL,GAAG;KACH,GAAG;KACH,SAAS;KACV;IACF;;EAEH,MAAM,QAAQ;AACZ,SAAM,MACJ,KACE;IACE,aAAa,aAAa,MAAM,KAAK,MAAM;IAC3C,SAAS,CAAC,oBAAoB,KAAK,CAAC;IACrC,EACD,eAAe,KAAK,CACrB,CACF;;EAEJ;;AAGH,kBAAe"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { t as EsbuildOptions } from "./build-CrohITJo.mjs";
|
|
2
|
+
import { PluginContext, ResolvedConfig, UserConfig } from "@powerlines/core/types";
|
|
3
|
+
|
|
4
|
+
//#region src/types/plugin.d.ts
|
|
5
|
+
type EsbuildPluginOptions = Partial<EsbuildOptions>;
|
|
6
|
+
interface EsbuildPluginUserConfig extends UserConfig {
|
|
7
|
+
esbuild?: EsbuildPluginOptions;
|
|
8
|
+
}
|
|
9
|
+
interface EsbuildPluginResolvedConfig extends ResolvedConfig {
|
|
10
|
+
esbuild: EsbuildOptions;
|
|
11
|
+
}
|
|
12
|
+
type EsbuildPluginContext<TResolvedConfig extends EsbuildPluginResolvedConfig = EsbuildPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
13
|
+
declare type __ΩEsbuildPluginOptions = any[];
|
|
14
|
+
declare type __ΩEsbuildPluginUserConfig = any[];
|
|
15
|
+
declare type __ΩEsbuildPluginResolvedConfig = any[];
|
|
16
|
+
declare type __ΩEsbuildPluginContext = any[];
|
|
17
|
+
//#endregion
|
|
18
|
+
export { __ΩEsbuildPluginContext as a, __ΩEsbuildPluginUserConfig as c, EsbuildPluginUserConfig as i, EsbuildPluginOptions as n, __ΩEsbuildPluginOptions as o, EsbuildPluginResolvedConfig as r, __ΩEsbuildPluginResolvedConfig as s, EsbuildPluginContext as t };
|
|
19
|
+
//# sourceMappingURL=plugin-Bivts13R.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-Bivts13R.d.mts","names":[],"sources":["../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;KAyBY,oBAAA,GAAuB,QAAQ;UAE1B,uBAAA,SAAgC;EAFrC,OAAA,CAAA,EAGA,oBAHoB;AAEhC;AAIiB,UAAA,2BAAA,SAAoC,cAAA,CAAA;EAIzC,OAAA,EAHD,cAGqB;;AAE5B,KAFQ,oBAER,CAAA,wBADsB,2BACtB,GAAA,2BAAA,CAAA,GACA,aADA,CACc,eADd,CAAA;AACc,uCAAA,GAAA,EAAA;AAAd,0CAAA,GAAA,EAAA;AAAa,8CAAA,GAAA,EAAA"}
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { t as EsbuildOptions } from "./build-Br4iCJ5d.cjs";
|
|
2
|
+
import { PluginContext, ResolvedConfig, UserConfig } from "@powerlines/core/types";
|
|
3
|
+
|
|
4
|
+
//#region src/types/plugin.d.ts
|
|
5
|
+
type EsbuildPluginOptions = Partial<EsbuildOptions>;
|
|
6
|
+
interface EsbuildPluginUserConfig extends UserConfig {
|
|
7
|
+
esbuild?: EsbuildPluginOptions;
|
|
8
|
+
}
|
|
9
|
+
interface EsbuildPluginResolvedConfig extends ResolvedConfig {
|
|
10
|
+
esbuild: EsbuildOptions;
|
|
11
|
+
}
|
|
12
|
+
type EsbuildPluginContext<TResolvedConfig extends EsbuildPluginResolvedConfig = EsbuildPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
13
|
+
declare type __ΩEsbuildPluginOptions = any[];
|
|
14
|
+
declare type __ΩEsbuildPluginUserConfig = any[];
|
|
15
|
+
declare type __ΩEsbuildPluginResolvedConfig = any[];
|
|
16
|
+
declare type __ΩEsbuildPluginContext = any[];
|
|
17
|
+
//#endregion
|
|
18
|
+
export { __ΩEsbuildPluginContext as a, __ΩEsbuildPluginUserConfig as c, EsbuildPluginUserConfig as i, EsbuildPluginOptions as n, __ΩEsbuildPluginOptions as o, EsbuildPluginResolvedConfig as r, __ΩEsbuildPluginResolvedConfig as s, EsbuildPluginContext as t };
|
|
19
|
+
//# sourceMappingURL=plugin-fp0p1CCy.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-fp0p1CCy.d.cts","names":[],"sources":["../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;KAyBY,oBAAA,GAAuB,QAAQ;UAE1B,uBAAA,SAAgC;EAFrC,OAAA,CAAA,EAGA,oBAHoB;AAEhC;AAIiB,UAAA,2BAAA,SAAoC,cAAA,CAAA;EAIzC,OAAA,EAHD,cAGqB;;AAE5B,KAFQ,oBAER,CAAA,wBADsB,2BACtB,GAAA,2BAAA,CAAA,GACA,aADA,CACc,eADd,CAAA;AACc,uCAAA,GAAA,EAAA;AAAd,0CAAA,GAAA,EAAA;AAAa,8CAAA,GAAA,EAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BuildOptions } from "esbuild";
|
|
2
|
+
import { PluginContext } from "@powerlines/core/types";
|
|
3
|
+
import { TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
4
|
+
|
|
5
|
+
//#region src/helpers/resolve.d.ts
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Compiles a type definition to a module and returns the module.
|
|
9
|
+
*
|
|
10
|
+
* @param context - The context object containing the environment paths.
|
|
11
|
+
* @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
|
|
12
|
+
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
13
|
+
* @returns A promise that resolves to the compiled module.
|
|
14
|
+
*/
|
|
15
|
+
declare function resolveModule<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?: Partial<BuildOptions>): Promise<TResult>;
|
|
16
|
+
/**
|
|
17
|
+
* Compiles a type definition to a module and returns the specified export from the module.
|
|
18
|
+
*
|
|
19
|
+
* @param context - The context object containing the environment paths.
|
|
20
|
+
* @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
|
|
21
|
+
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
22
|
+
* @returns A promise that resolves to the compiled module.
|
|
23
|
+
*/
|
|
24
|
+
declare function resolve<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?: Partial<BuildOptions>): Promise<TResult>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { resolveModule as n, resolve as t };
|
|
27
|
+
//# sourceMappingURL=resolve-BU3nddJ7.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-BU3nddJ7.d.mts","names":[],"sources":["../src/helpers/resolve.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAoCA;;;;;;AAIG,iBAJmB,aAInB,CAAA,OAAA,CAAA,CAAA,OAAA,EAHQ,aAGR,EAAA,IAAA,EAFK,uBAEL,EAAA,SAAA,CAAA,EADU,OACV,CADkB,YAClB,CAAA,CAAA,EAAA,OAAA,CAAQ,OAAR,CAAA;;AAqEH;;;;;;;AAIU,iBAJY,OAIZ,CAAA,OAAA,CAAA,CAAA,OAAA,EAHC,aAGD,EAAA,IAAA,EAFF,uBAEE,EAAA,SAAA,CAAA,EADG,OACH,CADW,YACX,CAAA,CAAA,EAAP,OAAO,CAAC,OAAD,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BuildOptions } from "esbuild";
|
|
2
|
+
import { PluginContext } from "@powerlines/core/types";
|
|
3
|
+
import { TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
4
|
+
|
|
5
|
+
//#region src/helpers/resolve.d.ts
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Compiles a type definition to a module and returns the module.
|
|
9
|
+
*
|
|
10
|
+
* @param context - The context object containing the environment paths.
|
|
11
|
+
* @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
|
|
12
|
+
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
13
|
+
* @returns A promise that resolves to the compiled module.
|
|
14
|
+
*/
|
|
15
|
+
declare function resolveModule<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?: Partial<BuildOptions>): Promise<TResult>;
|
|
16
|
+
/**
|
|
17
|
+
* Compiles a type definition to a module and returns the specified export from the module.
|
|
18
|
+
*
|
|
19
|
+
* @param context - The context object containing the environment paths.
|
|
20
|
+
* @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
|
|
21
|
+
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
22
|
+
* @returns A promise that resolves to the compiled module.
|
|
23
|
+
*/
|
|
24
|
+
declare function resolve<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?: Partial<BuildOptions>): Promise<TResult>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { resolveModule as n, resolve as t };
|
|
27
|
+
//# sourceMappingURL=resolve-BUiEAXVB.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-BUiEAXVB.d.cts","names":[],"sources":["../src/helpers/resolve.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAoCA;;;;;;AAIG,iBAJmB,aAInB,CAAA,OAAA,CAAA,CAAA,OAAA,EAHQ,aAGR,EAAA,IAAA,EAFK,uBAEL,EAAA,SAAA,CAAA,EADU,OACV,CADkB,YAClB,CAAA,CAAA,EAAA,OAAA,CAAQ,OAAR,CAAA;;AAqEH;;;;;;;AAIU,iBAJY,OAIZ,CAAA,OAAA,CAAA,CAAA,OAAA,EAHC,aAGD,EAAA,IAAA,EAFF,uBAEE,EAAA,SAAA,CAAA,EADG,OACH,CADW,YACX,CAAA,CAAA,EAAP,OAAO,CAAC,OAAD,CAAA"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { bundle } from "@powerlines/plugin-esbuild/helpers/bundle";
|
|
2
|
+
import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
|
|
3
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
4
|
+
|
|
5
|
+
//#region src/helpers/resolve.ts
|
|
6
|
+
/**
|
|
7
|
+
* Compiles a type definition to a module and returns the module.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The context object containing the environment paths.
|
|
10
|
+
* @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
|
|
11
|
+
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
12
|
+
* @returns A promise that resolves to the compiled module.
|
|
13
|
+
*/
|
|
14
|
+
async function resolveModule(context, type, overrides = {}) {
|
|
15
|
+
let typeDefinition;
|
|
16
|
+
if (isSetString(type)) typeDefinition = parseTypeDefinition(type);
|
|
17
|
+
else typeDefinition = type;
|
|
18
|
+
const result = await bundle(context, typeDefinition.file, overrides);
|
|
19
|
+
let resolved;
|
|
20
|
+
try {
|
|
21
|
+
resolved = await context.resolver.evalModule(result.text, {
|
|
22
|
+
filename: result.path,
|
|
23
|
+
forceTranspile: true
|
|
24
|
+
});
|
|
25
|
+
} catch (error) {
|
|
26
|
+
if (isSetString(error.message) && (/* @__PURE__ */ new RegExp(`Cannot find module '${context.config.framework || "powerlines"}:.*'`)).test(error.message)) {
|
|
27
|
+
const moduleName = error.message.match(/* @__PURE__ */ new RegExp(`Cannot find module '(${context.config.framework || "powerlines"}:.*)'`))?.[1];
|
|
28
|
+
throw new Error(`The module "${moduleName}" could not be resolved while evaluating "${typeDefinition.file}". It is possible the required built-in modules have not yet been generated. Please check the order of your plugins. ${context.config.logLevel === "debug" || context.config.logLevel === "trace" ? `
|
|
29
|
+
|
|
30
|
+
Bundle output for module:
|
|
31
|
+
${result.text}` : ""}`);
|
|
32
|
+
}
|
|
33
|
+
throw new Error(`Failed to evaluate the bundled module for "${typeDefinition.file}". Error: ${error.message}${context.config.logLevel === "debug" || context.config.logLevel === "trace" ? `
|
|
34
|
+
|
|
35
|
+
Bundle output for module:
|
|
36
|
+
${result.text}` : ""}`);
|
|
37
|
+
}
|
|
38
|
+
return resolved;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Compiles a type definition to a module and returns the specified export from the module.
|
|
42
|
+
*
|
|
43
|
+
* @param context - The context object containing the environment paths.
|
|
44
|
+
* @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
|
|
45
|
+
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
46
|
+
* @returns A promise that resolves to the compiled module.
|
|
47
|
+
*/
|
|
48
|
+
async function resolve(context, type, overrides = {}) {
|
|
49
|
+
let typeDefinition;
|
|
50
|
+
if (isSetString(type)) typeDefinition = parseTypeDefinition(type);
|
|
51
|
+
else typeDefinition = type;
|
|
52
|
+
const resolved = await resolveModule(context, typeDefinition, overrides);
|
|
53
|
+
let exportName = typeDefinition.name;
|
|
54
|
+
if (!exportName) exportName = "default";
|
|
55
|
+
const resolvedExport = resolved[exportName] ?? resolved[`__Ω${exportName}`];
|
|
56
|
+
if (resolvedExport === void 0) throw new Error(`The export "${exportName}" could not be resolved in the "${typeDefinition.file}" module. ${Object.keys(resolved).length === 0 ? `After bundling, no exports were found in the module. Please ensure that the "${typeDefinition.file}" module has a "${exportName}" export with the desired value.` : `After bundling, the available exports were: ${Object.keys(resolved).join(", ")}. Please ensure that the export exists and is correctly named.`}`);
|
|
57
|
+
return resolvedExport;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { resolveModule as n, resolve as t };
|
|
62
|
+
//# sourceMappingURL=resolve-C8OzoP-s.mjs.map
|