@powerlines/schema 0.11.52 → 0.11.54
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/bundle.cjs +21 -35
- package/dist/bundle.d.cts +4 -4
- package/dist/bundle.d.cts.map +1 -1
- package/dist/bundle.d.mts +4 -4
- package/dist/bundle.d.mts.map +1 -1
- package/dist/bundle.mjs +22 -36
- package/dist/bundle.mjs.map +1 -1
- package/dist/extract.d.cts +1 -1
- package/dist/extract.d.mts +1 -1
- package/dist/resolve.cjs +7 -7
- package/dist/resolve.mjs +7 -7
- package/dist/resolve.mjs.map +1 -1
- package/package.json +5 -5
package/dist/bundle.cjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
2
|
let _powerlines_core_lib_unplugin = require("@powerlines/core/lib/unplugin");
|
|
3
|
-
let
|
|
4
|
-
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
3
|
+
let _powerlines_unplugin_esbuild = require("@powerlines/unplugin/esbuild");
|
|
5
4
|
let _stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
6
5
|
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
7
6
|
let defu = require("defu");
|
|
8
7
|
defu = require_runtime.__toESM(defu, 1);
|
|
9
|
-
let
|
|
8
|
+
let esbuild = require("esbuild");
|
|
10
9
|
let unplugin = require("unplugin");
|
|
11
10
|
|
|
12
11
|
//#region src/bundle.ts
|
|
@@ -15,46 +14,33 @@ let unplugin = require("unplugin");
|
|
|
15
14
|
*
|
|
16
15
|
* @param context - The context object containing the environment paths.
|
|
17
16
|
* @param file - The file path to bundle.
|
|
18
|
-
* @param options - Optional overrides for the
|
|
17
|
+
* @param options - Optional overrides for the ESBuild configuration.
|
|
19
18
|
* @returns A promise that resolves to the bundled module.
|
|
20
19
|
*/
|
|
21
20
|
async function bundle(context, file, options = {}) {
|
|
22
21
|
const path = await context.fs.resolve(file);
|
|
23
22
|
if (!path || !context.fs.existsSync(path)) throw new Error(`Module not found: "${file}". Please check the path and try again.`);
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const result = await (0, rolldown.build)({
|
|
23
|
+
const result = await (0, esbuild.build)((0, defu.default)({
|
|
24
|
+
entryPoints: [path],
|
|
25
|
+
write: false,
|
|
26
|
+
sourcemap: false,
|
|
27
|
+
splitting: false,
|
|
28
|
+
treeShaking: true,
|
|
31
29
|
bundle: true,
|
|
30
|
+
packages: "bundle",
|
|
32
31
|
platform: "node",
|
|
33
|
-
...(0, _powerlines_unplugin_rolldown.resolveOptions)(context),
|
|
34
|
-
...userOptions,
|
|
35
32
|
logLevel: "silent",
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
write: false,
|
|
48
|
-
plugins: [...plugins ? (0, _stryke_convert_to_array.toArray)(plugins) : [], (0, unplugin.createRolldownPlugin)((0, _powerlines_core_lib_unplugin.createUnpluginResolver)(context, {
|
|
49
|
-
name: options.name ?? `${(0, _stryke_path_file_path_fns.findFileName)(file)} Bundler`,
|
|
50
|
-
prefix: false,
|
|
51
|
-
overrides: (0, defu.default)(options.resolve ?? {}, { skipNodeModulesBundle: false }, context.config.resolve),
|
|
52
|
-
silenceHookLogging: true
|
|
53
|
-
}))()].filter(Boolean)
|
|
54
|
-
});
|
|
55
|
-
if (!result.output || result.output.length === 0) throw new Error(`No output files generated for ${file}. Please check the configuration and try again.`);
|
|
56
|
-
if (result.output.length > 1) context.warn(`Multiple output files generated for "${file}". Only the first file will be used. Please check the configuration to ensure only one output file is generated.`);
|
|
57
|
-
return result.output[0];
|
|
33
|
+
...(0, _stryke_helpers_omit.omit)(options, ["name", "resolve"])
|
|
34
|
+
}, (0, _powerlines_unplugin_esbuild.resolveOptions)(context), { plugins: [(0, unplugin.createEsbuildPlugin)((0, _powerlines_core_lib_unplugin.createUnpluginResolver)(context, {
|
|
35
|
+
name: options.name ?? `${(0, _stryke_path_file_path_fns.findFileName)(file)} Bundler`,
|
|
36
|
+
prefix: false,
|
|
37
|
+
overrides: (0, defu.default)(options.resolve ?? {}, { skipNodeModulesBundle: false }, context.config.resolve),
|
|
38
|
+
silenceHookLogging: true
|
|
39
|
+
}))()] }));
|
|
40
|
+
if (result.errors.length > 0) throw new Error(`Failed to bundle ${file}: ${result.errors.map((error) => error.text).join(", ")}`);
|
|
41
|
+
if (result.warnings.length > 0) context.warn(`Warnings while bundling ${file}: ${result.warnings.map((warning) => warning.text).join(", ")}`);
|
|
42
|
+
if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) throw new Error(`No output files generated for ${file}. Please check the configuration and try again.`);
|
|
43
|
+
return result.outputFiles.filter(Boolean)[0];
|
|
58
44
|
}
|
|
59
45
|
|
|
60
46
|
//#endregion
|
package/dist/bundle.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ResolveOptions, UnresolvedContext } from "@powerlines/core";
|
|
2
2
|
import { DeepPartial } from "@stryke/types/base";
|
|
3
|
-
import { BuildOptions,
|
|
3
|
+
import { BuildOptions, OutputFile } from "esbuild";
|
|
4
4
|
|
|
5
5
|
//#region src/bundle.d.ts
|
|
6
|
-
type BundleOptions = DeepPartial<
|
|
6
|
+
type BundleOptions = DeepPartial<BuildOptions> & {
|
|
7
7
|
name?: string;
|
|
8
8
|
resolve?: DeepPartial<ResolveOptions>;
|
|
9
9
|
};
|
|
@@ -12,10 +12,10 @@ type BundleOptions = DeepPartial<Omit<BuildOptions, "input" | "write">> & {
|
|
|
12
12
|
*
|
|
13
13
|
* @param context - The context object containing the environment paths.
|
|
14
14
|
* @param file - The file path to bundle.
|
|
15
|
-
* @param options - Optional overrides for the
|
|
15
|
+
* @param options - Optional overrides for the ESBuild configuration.
|
|
16
16
|
* @returns A promise that resolves to the bundled module.
|
|
17
17
|
*/
|
|
18
|
-
declare function bundle<TContext extends UnresolvedContext>(context: TContext, file: string, options?: BundleOptions): Promise<
|
|
18
|
+
declare function bundle<TContext extends UnresolvedContext>(context: TContext, file: string, options?: BundleOptions): Promise<OutputFile>;
|
|
19
19
|
//#endregion
|
|
20
20
|
export { BundleOptions, bundle };
|
|
21
21
|
//# sourceMappingURL=bundle.d.cts.map
|
package/dist/bundle.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.cts","names":[],"sources":["../src/bundle.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"bundle.d.cts","names":[],"sources":["../src/bundle.ts"],"mappings":";;;;;KAiCY,aAAA,GAAgB,WAAA,CAAY,YAAA;EACtC,IAAA;EACA,OAAA,GAAU,WAAA,CAAY,cAAA;AAAA;;;;;;;;;iBAWF,MAAA,kBAAwB,iBAAA,CAAA,CAC5C,OAAA,EAAS,QAAA,EACT,IAAA,UACA,OAAA,GAAS,aAAA,GACR,OAAA,CAAQ,UAAA"}
|
package/dist/bundle.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { BuildOptions,
|
|
1
|
+
import { BuildOptions, OutputFile } from "esbuild";
|
|
2
2
|
import { ResolveOptions, UnresolvedContext } from "@powerlines/core";
|
|
3
3
|
import { DeepPartial } from "@stryke/types/base";
|
|
4
4
|
|
|
5
5
|
//#region src/bundle.d.ts
|
|
6
|
-
type BundleOptions = DeepPartial<
|
|
6
|
+
type BundleOptions = DeepPartial<BuildOptions> & {
|
|
7
7
|
name?: string;
|
|
8
8
|
resolve?: DeepPartial<ResolveOptions>;
|
|
9
9
|
};
|
|
@@ -12,10 +12,10 @@ type BundleOptions = DeepPartial<Omit<BuildOptions, "input" | "write">> & {
|
|
|
12
12
|
*
|
|
13
13
|
* @param context - The context object containing the environment paths.
|
|
14
14
|
* @param file - The file path to bundle.
|
|
15
|
-
* @param options - Optional overrides for the
|
|
15
|
+
* @param options - Optional overrides for the ESBuild configuration.
|
|
16
16
|
* @returns A promise that resolves to the bundled module.
|
|
17
17
|
*/
|
|
18
|
-
declare function bundle<TContext extends UnresolvedContext>(context: TContext, file: string, options?: BundleOptions): Promise<
|
|
18
|
+
declare function bundle<TContext extends UnresolvedContext>(context: TContext, file: string, options?: BundleOptions): Promise<OutputFile>;
|
|
19
19
|
//#endregion
|
|
20
20
|
export { BundleOptions, bundle };
|
|
21
21
|
//# sourceMappingURL=bundle.d.mts.map
|
package/dist/bundle.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.mts","names":[],"sources":["../src/bundle.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"bundle.d.mts","names":[],"sources":["../src/bundle.ts"],"mappings":";;;;;KAiCY,aAAA,GAAgB,WAAA,CAAY,YAAA;EACtC,IAAA;EACA,OAAA,GAAU,WAAA,CAAY,cAAA;AAAA;;;;;;;;;iBAWF,MAAA,kBAAwB,iBAAA,CAAA,CAC5C,OAAA,EAAS,QAAA,EACT,IAAA,UACA,OAAA,GAAS,aAAA,GACR,OAAA,CAAQ,UAAA"}
|
package/dist/bundle.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { createUnpluginResolver } from "@powerlines/core/lib/unplugin";
|
|
2
|
-
import { resolveOptions } from "@powerlines/unplugin/
|
|
3
|
-
import { toArray } from "@stryke/convert/to-array";
|
|
2
|
+
import { resolveOptions } from "@powerlines/unplugin/esbuild";
|
|
4
3
|
import { omit } from "@stryke/helpers/omit";
|
|
5
4
|
import { findFileName } from "@stryke/path/file-path-fns";
|
|
6
5
|
import defu from "defu";
|
|
7
|
-
import { build } from "
|
|
8
|
-
import {
|
|
6
|
+
import { build } from "esbuild";
|
|
7
|
+
import { createEsbuildPlugin } from "unplugin";
|
|
9
8
|
|
|
10
9
|
//#region src/bundle.ts
|
|
11
10
|
/**
|
|
@@ -13,46 +12,33 @@ import { createRolldownPlugin } from "unplugin";
|
|
|
13
12
|
*
|
|
14
13
|
* @param context - The context object containing the environment paths.
|
|
15
14
|
* @param file - The file path to bundle.
|
|
16
|
-
* @param options - Optional overrides for the
|
|
15
|
+
* @param options - Optional overrides for the ESBuild configuration.
|
|
17
16
|
* @returns A promise that resolves to the bundled module.
|
|
18
17
|
*/
|
|
19
18
|
async function bundle(context, file, options = {}) {
|
|
20
19
|
const path = await context.fs.resolve(file);
|
|
21
20
|
if (!path || !context.fs.existsSync(path)) throw new Error(`Module not found: "${file}". Please check the path and try again.`);
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const result = await build({
|
|
21
|
+
const result = await build(defu({
|
|
22
|
+
entryPoints: [path],
|
|
23
|
+
write: false,
|
|
24
|
+
sourcemap: false,
|
|
25
|
+
splitting: false,
|
|
26
|
+
treeShaking: true,
|
|
29
27
|
bundle: true,
|
|
28
|
+
packages: "bundle",
|
|
30
29
|
platform: "node",
|
|
31
|
-
...resolveOptions(context),
|
|
32
|
-
...userOptions,
|
|
33
30
|
logLevel: "silent",
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
write: false,
|
|
46
|
-
plugins: [...plugins ? toArray(plugins) : [], createRolldownPlugin(createUnpluginResolver(context, {
|
|
47
|
-
name: options.name ?? `${findFileName(file)} Bundler`,
|
|
48
|
-
prefix: false,
|
|
49
|
-
overrides: defu(options.resolve ?? {}, { skipNodeModulesBundle: false }, context.config.resolve),
|
|
50
|
-
silenceHookLogging: true
|
|
51
|
-
}))()].filter(Boolean)
|
|
52
|
-
});
|
|
53
|
-
if (!result.output || result.output.length === 0) throw new Error(`No output files generated for ${file}. Please check the configuration and try again.`);
|
|
54
|
-
if (result.output.length > 1) context.warn(`Multiple output files generated for "${file}". Only the first file will be used. Please check the configuration to ensure only one output file is generated.`);
|
|
55
|
-
return result.output[0];
|
|
31
|
+
...omit(options, ["name", "resolve"])
|
|
32
|
+
}, resolveOptions(context), { plugins: [createEsbuildPlugin(createUnpluginResolver(context, {
|
|
33
|
+
name: options.name ?? `${findFileName(file)} Bundler`,
|
|
34
|
+
prefix: false,
|
|
35
|
+
overrides: defu(options.resolve ?? {}, { skipNodeModulesBundle: false }, context.config.resolve),
|
|
36
|
+
silenceHookLogging: true
|
|
37
|
+
}))()] }));
|
|
38
|
+
if (result.errors.length > 0) throw new Error(`Failed to bundle ${file}: ${result.errors.map((error) => error.text).join(", ")}`);
|
|
39
|
+
if (result.warnings.length > 0) context.warn(`Warnings while bundling ${file}: ${result.warnings.map((warning) => warning.text).join(", ")}`);
|
|
40
|
+
if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) throw new Error(`No output files generated for ${file}. Please check the configuration and try again.`);
|
|
41
|
+
return result.outputFiles.filter(Boolean)[0];
|
|
56
42
|
}
|
|
57
43
|
|
|
58
44
|
//#endregion
|
package/dist/bundle.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.mjs","names":[],"sources":["../src/bundle.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n CreateUnpluginResolverOptions,\n ResolveOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport { createUnpluginResolver } from \"@powerlines/core/lib/unplugin\";\nimport { resolveOptions } from \"@powerlines/unplugin/
|
|
1
|
+
{"version":3,"file":"bundle.mjs","names":[],"sources":["../src/bundle.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n CreateUnpluginResolverOptions,\n ResolveOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport { createUnpluginResolver } from \"@powerlines/core/lib/unplugin\";\nimport { resolveOptions } from \"@powerlines/unplugin/esbuild\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { DeepPartial } from \"@stryke/types/base\";\nimport defu from \"defu\";\nimport type { BuildOptions } from \"esbuild\";\nimport { build, OutputFile } from \"esbuild\";\nimport { createEsbuildPlugin } from \"unplugin\";\n\nexport type BundleOptions = DeepPartial<BuildOptions> & {\n name?: string;\n resolve?: DeepPartial<ResolveOptions>;\n};\n\n/**\n * Bundle a type definition to a module.\n *\n * @param context - The context object containing the environment paths.\n * @param file - The file path to bundle.\n * @param options - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the bundled module.\n */\nexport async function bundle<TContext extends UnresolvedContext>(\n context: TContext,\n file: string,\n options: BundleOptions = {}\n): Promise<OutputFile> {\n const path = await context.fs.resolve(file);\n if (!path || !context.fs.existsSync(path)) {\n throw new Error(\n `Module not found: \"${file}\". Please check the path and try again.`\n );\n }\n\n const result = await build(\n defu(\n {\n entryPoints: [path],\n write: false,\n sourcemap: false,\n splitting: false,\n treeShaking: true,\n bundle: true,\n packages: \"bundle\",\n platform: \"node\",\n logLevel: \"silent\",\n ...omit(options, [\"name\", \"resolve\"])\n },\n resolveOptions(context),\n {\n plugins: [\n createEsbuildPlugin(\n createUnpluginResolver(context, {\n name: options.name ?? `${findFileName(file)} Bundler`,\n prefix: false,\n overrides: defu(\n options.resolve ?? {},\n { skipNodeModulesBundle: false },\n context.config.resolve\n ) as CreateUnpluginResolverOptions[\"overrides\"],\n silenceHookLogging: true\n })\n )()\n ]\n }\n )\n );\n if (result.errors.length > 0) {\n throw new Error(\n `Failed to bundle ${file}: ${result.errors\n .map(error => error.text)\n .join(\", \")}`\n );\n }\n if (result.warnings.length > 0) {\n context.warn(\n `Warnings while bundling ${file}: ${result.warnings\n .map(warning => warning.text)\n .join(\", \")}`\n );\n }\n if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) {\n throw new Error(\n `No output files generated for ${\n file\n }. Please check the configuration and try again.`\n );\n }\n\n return result.outputFiles.filter(Boolean)[0]!;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA8CA,eAAsB,OACpB,SACA,MACA,UAAyB,CAAC,GACL;CACrB,MAAM,OAAO,MAAM,QAAQ,GAAG,QAAQ,IAAI;CAC1C,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,WAAW,IAAI,GACtC,MAAM,IAAI,MACR,sBAAsB,KAAK,wCAC7B;CAGF,MAAM,SAAS,MAAM,MACnB,KACE;EACE,aAAa,CAAC,IAAI;EAClB,OAAO;EACP,WAAW;EACX,WAAW;EACX,aAAa;EACb,QAAQ;EACR,UAAU;EACV,UAAU;EACV,UAAU;EACV,GAAG,KAAK,SAAS,CAAC,QAAQ,SAAS,CAAC;CACtC,GACA,eAAe,OAAO,GACtB,EACE,SAAS,CACP,oBACE,uBAAuB,SAAS;EAC9B,MAAM,QAAQ,QAAQ,GAAG,aAAa,IAAI,EAAE;EAC5C,QAAQ;EACR,WAAW,KACT,QAAQ,WAAW,CAAC,GACpB,EAAE,uBAAuB,MAAM,GAC/B,QAAQ,OAAO,OACjB;EACA,oBAAoB;CACtB,CAAC,CACH,EAAE,CACJ,EACF,CACF,CACF;CACA,IAAI,OAAO,OAAO,SAAS,GACzB,MAAM,IAAI,MACR,oBAAoB,KAAK,IAAI,OAAO,OACjC,KAAI,UAAS,MAAM,IAAI,EACvB,KAAK,IAAI,GACd;CAEF,IAAI,OAAO,SAAS,SAAS,GAC3B,QAAQ,KACN,2BAA2B,KAAK,IAAI,OAAO,SACxC,KAAI,YAAW,QAAQ,IAAI,EAC3B,KAAK,IAAI,GACd;CAEF,IAAI,CAAC,OAAO,eAAe,OAAO,YAAY,OAAO,OAAO,EAAE,WAAW,GACvE,MAAM,IAAI,MACR,iCACE,KACD,gDACH;CAGF,OAAO,OAAO,YAAY,OAAO,OAAO,EAAE;AAC5C"}
|
package/dist/extract.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExtractedSchema, JsonSchema, Schema, SchemaInput, SchemaInputVariant, SchemaSource, SchemaSourceInput, SchemaSourceVariant } from "./types.cjs";
|
|
2
2
|
import { Context } from "@powerlines/core";
|
|
3
|
-
import { BuildOptions } from "rolldown";
|
|
4
3
|
import { Type } from "@powerlines/deepkit/vendor/type";
|
|
4
|
+
import { BuildOptions } from "rolldown";
|
|
5
5
|
|
|
6
6
|
//#region src/extract.d.ts
|
|
7
7
|
/**
|
package/dist/extract.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExtractedSchema, JsonSchema, Schema, SchemaInput, SchemaInputVariant, SchemaSource, SchemaSourceInput, SchemaSourceVariant } from "./types.mjs";
|
|
2
|
-
import { BuildOptions } from "rolldown";
|
|
3
2
|
import { Context } from "@powerlines/core";
|
|
4
3
|
import { Type } from "@powerlines/deepkit/vendor/type";
|
|
4
|
+
import { BuildOptions } from "rolldown";
|
|
5
5
|
|
|
6
6
|
//#region src/extract.d.ts
|
|
7
7
|
/**
|
package/dist/resolve.cjs
CHANGED
|
@@ -3,8 +3,8 @@ const require_bundle = require('./bundle.cjs');
|
|
|
3
3
|
let defu = require("defu");
|
|
4
4
|
defu = require_runtime.__toESM(defu, 1);
|
|
5
5
|
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
6
|
-
let _powerlines_deepkit_rolldown_plugin = require("@powerlines/deepkit/rolldown-plugin");
|
|
7
6
|
let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
7
|
+
let _powerlines_deepkit_esbuild_plugin = require("@powerlines/deepkit/esbuild-plugin");
|
|
8
8
|
let _stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
|
|
9
9
|
let _stryke_path_find = require("@stryke/path/find");
|
|
10
10
|
|
|
@@ -24,9 +24,9 @@ async function resolveModule(context, type, overrides) {
|
|
|
24
24
|
const result = await require_bundle.bundle(context, typeDefinition.file, overrides);
|
|
25
25
|
let resolved;
|
|
26
26
|
try {
|
|
27
|
-
resolved = await context.resolver.evalModule(result.
|
|
28
|
-
filename: result.
|
|
29
|
-
ext: (0, _stryke_path_find.findFileDotExtension)(result.
|
|
27
|
+
resolved = await context.resolver.evalModule(result.text, {
|
|
28
|
+
filename: result.path,
|
|
29
|
+
ext: (0, _stryke_path_find.findFileDotExtension)(result.path)
|
|
30
30
|
});
|
|
31
31
|
} catch (error) {
|
|
32
32
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(error.message) && new RegExp(`Cannot find module '${context.config.framework?.name || "powerlines"}:.*'`).test(error.message)) {
|
|
@@ -34,12 +34,12 @@ async function resolveModule(context, type, overrides) {
|
|
|
34
34
|
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.general === "debug" || context.config.logLevel.general === "trace" ? `
|
|
35
35
|
|
|
36
36
|
Bundle output for module:
|
|
37
|
-
${result.
|
|
37
|
+
${result.text}` : ""}`);
|
|
38
38
|
}
|
|
39
39
|
throw new Error(`Failed to evaluate the bundled module for "${typeDefinition.file}". Error: ${error.message}${context.config.logLevel.general === "debug" || context.config.logLevel.general === "trace" ? `
|
|
40
40
|
|
|
41
41
|
Bundle output for module:
|
|
42
|
-
${result.
|
|
42
|
+
${result.text}` : ""}`);
|
|
43
43
|
}
|
|
44
44
|
return resolved;
|
|
45
45
|
}
|
|
@@ -71,7 +71,7 @@ async function resolve(context, input, options) {
|
|
|
71
71
|
* @returns A promise that resolves to the Deepkit Type reflection.
|
|
72
72
|
*/
|
|
73
73
|
async function resolveReflection(context, input, options) {
|
|
74
|
-
return (0, _powerlines_deepkit_vendor_type.reflect)(await resolve(context, input, (0, defu.default)(options, { plugins: [(0,
|
|
74
|
+
return (0, _powerlines_deepkit_vendor_type.reflect)(await resolve(context, input, (0, defu.default)(options, { plugins: [(0, _powerlines_deepkit_esbuild_plugin.esbuildPlugin)(context, {
|
|
75
75
|
reflection: "default",
|
|
76
76
|
level: "all"
|
|
77
77
|
})] })));
|
package/dist/resolve.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { bundle } from "./bundle.mjs";
|
|
2
2
|
import defu from "defu";
|
|
3
3
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
4
|
-
import { rolldownPlugin } from "@powerlines/deepkit/rolldown-plugin";
|
|
5
4
|
import { reflect } from "@powerlines/deepkit/vendor/type";
|
|
5
|
+
import { esbuildPlugin } from "@powerlines/deepkit/esbuild-plugin";
|
|
6
6
|
import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
|
|
7
7
|
import { findFileDotExtension } from "@stryke/path/find";
|
|
8
8
|
|
|
@@ -22,9 +22,9 @@ async function resolveModule(context, type, overrides) {
|
|
|
22
22
|
const result = await bundle(context, typeDefinition.file, overrides);
|
|
23
23
|
let resolved;
|
|
24
24
|
try {
|
|
25
|
-
resolved = await context.resolver.evalModule(result.
|
|
26
|
-
filename: result.
|
|
27
|
-
ext: findFileDotExtension(result.
|
|
25
|
+
resolved = await context.resolver.evalModule(result.text, {
|
|
26
|
+
filename: result.path,
|
|
27
|
+
ext: findFileDotExtension(result.path)
|
|
28
28
|
});
|
|
29
29
|
} catch (error) {
|
|
30
30
|
if (isSetString(error.message) && new RegExp(`Cannot find module '${context.config.framework?.name || "powerlines"}:.*'`).test(error.message)) {
|
|
@@ -32,12 +32,12 @@ async function resolveModule(context, type, overrides) {
|
|
|
32
32
|
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.general === "debug" || context.config.logLevel.general === "trace" ? `
|
|
33
33
|
|
|
34
34
|
Bundle output for module:
|
|
35
|
-
${result.
|
|
35
|
+
${result.text}` : ""}`);
|
|
36
36
|
}
|
|
37
37
|
throw new Error(`Failed to evaluate the bundled module for "${typeDefinition.file}". Error: ${error.message}${context.config.logLevel.general === "debug" || context.config.logLevel.general === "trace" ? `
|
|
38
38
|
|
|
39
39
|
Bundle output for module:
|
|
40
|
-
${result.
|
|
40
|
+
${result.text}` : ""}`);
|
|
41
41
|
}
|
|
42
42
|
return resolved;
|
|
43
43
|
}
|
|
@@ -69,7 +69,7 @@ async function resolve(context, input, options) {
|
|
|
69
69
|
* @returns A promise that resolves to the Deepkit Type reflection.
|
|
70
70
|
*/
|
|
71
71
|
async function resolveReflection(context, input, options) {
|
|
72
|
-
return reflect(await resolve(context, input, defu(options, { plugins: [
|
|
72
|
+
return reflect(await resolve(context, input, defu(options, { plugins: [esbuildPlugin(context, {
|
|
73
73
|
reflection: "default",
|
|
74
74
|
level: "all"
|
|
75
75
|
})] })));
|
package/dist/resolve.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.mjs","names":[],"sources":["../src/resolve.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { PluginContext, UnresolvedContext } from \"@powerlines/core\";\nimport {
|
|
1
|
+
{"version":3,"file":"resolve.mjs","names":[],"sources":["../src/resolve.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { PluginContext, UnresolvedContext } from \"@powerlines/core\";\nimport { esbuildPlugin } from \"@powerlines/deepkit/esbuild-plugin\";\nimport { reflect, Type } from \"@powerlines/deepkit/vendor/type\";\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { findFileDotExtension } from \"@stryke/path/find\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { TypeDefinition } from \"@stryke/types/configuration\";\nimport defu from \"defu\";\nimport { bundle, BundleOptions } from \"./bundle\";\nimport { TypeDefinitionReference } from \"./types\";\n\n/**\n * Compiles a type definition to a module and returns the module.\n *\n * @param context - The context object containing the environment paths.\n * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.\n * @param overrides - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the compiled module.\n */\nexport async function resolveModule<\n TResult,\n TContext extends UnresolvedContext = UnresolvedContext\n>(\n context: TContext,\n type: TypeDefinitionReference,\n overrides?: BundleOptions\n): Promise<TResult> {\n let typeDefinition!: TypeDefinition;\n if (isSetString(type)) {\n typeDefinition = parseTypeDefinition(type) as TypeDefinition;\n } else {\n typeDefinition = type;\n }\n\n const result = await bundle<TContext>(\n context,\n typeDefinition.file,\n overrides\n );\n\n let resolved: any;\n try {\n resolved = await context.resolver.evalModule(result.text, {\n filename: result.path,\n ext: findFileDotExtension(result.path)\n });\n } catch (error) {\n if (\n isSetString((error as Error).message) &&\n new RegExp(\n `Cannot find module '${context.config.framework?.name || \"powerlines\"}:.*'`\n ).test((error as Error).message)\n ) {\n const moduleName = (error as Error).message.match(\n new RegExp(\n `Cannot find module '(${context.config.framework?.name || \"powerlines\"}:.*)'`\n )\n )?.[1];\n throw new Error(\n `The module \"${moduleName}\" could not be resolved while evaluating \"${\n typeDefinition.file\n }\". It is possible the required built-in modules have not yet been generated. Please check the order of your plugins. ${\n context.config.logLevel.general === \"debug\" ||\n context.config.logLevel.general === \"trace\"\n ? `\n\nBundle output for module:\n${result.text}`\n : \"\"\n }`\n );\n }\n\n throw new Error(\n `Failed to evaluate the bundled module for \"${\n typeDefinition.file\n }\". Error: ${(error as Error).message}${\n context.config.logLevel.general === \"debug\" ||\n context.config.logLevel.general === \"trace\"\n ? `\n\nBundle output for module:\n${result.text}`\n : \"\"\n }`\n );\n }\n\n return resolved;\n}\n\n/**\n * Compiles a type definition to a module and returns the specified export from the module.\n *\n * @param context - The context object containing the environment paths.\n * @param input - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.\n * @param options - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the compiled module.\n */\nexport async function resolve<\n TResult,\n TContext extends UnresolvedContext = UnresolvedContext\n>(\n context: TContext,\n input: TypeDefinitionReference,\n options?: BundleOptions\n): Promise<TResult> {\n let typeDefinition!: TypeDefinition;\n if (isSetString(input)) {\n typeDefinition = parseTypeDefinition(input) as TypeDefinition;\n } else {\n typeDefinition = input;\n }\n\n const resolved = await resolveModule<Record<string, any>, TContext>(\n context,\n typeDefinition,\n options\n );\n\n let exportName = typeDefinition.name;\n if (!exportName) {\n exportName = \"default\";\n }\n\n const resolvedExport = resolved[exportName] ?? resolved[`__Ω${exportName}`];\n if (resolvedExport === undefined) {\n throw new Error(\n `The export \"${exportName}\" could not be resolved in the \"${\n typeDefinition.file\n }\" module. ${\n Object.keys(resolved).length === 0\n ? `After bundling, no exports were found in the module. Please ensure that the \"${\n typeDefinition.file\n }\" module has a \"${exportName}\" export with the desired value.`\n : `After bundling, the available exports were: ${Object.keys(\n resolved\n ).join(\n \", \"\n )}. Please ensure that the export exists and is correctly named.`\n }`\n );\n }\n\n return resolvedExport;\n}\n\n/**\n * Resolves a type definition to a Deepkit Type reflection. This function compiles the provided type definition to a module, evaluates the module to get the specified export, and then reflects the export to get its Deepkit Type reflection.\n *\n * @param context - The context object containing the environment paths.\n * @param input - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.\n * @param options - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the Deepkit Type reflection.\n */\nexport async function resolveReflection<\n TContext extends PluginContext = PluginContext\n>(\n context: TContext,\n input: TypeDefinitionReference,\n options?: BundleOptions\n): Promise<Type> {\n return reflect(\n await resolve<Type>(\n context,\n input,\n defu(options, {\n plugins: [\n esbuildPlugin(context, {\n reflection: \"default\",\n level: \"all\"\n })\n ]\n })\n )\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAqCA,eAAsB,cAIpB,SACA,MACA,WACkB;CAClB,IAAI;CACJ,IAAI,YAAY,IAAI,GAClB,iBAAiB,oBAAoB,IAAI;MAEzC,iBAAiB;CAGnB,MAAM,SAAS,MAAM,OACnB,SACA,eAAe,MACf,SACF;CAEA,IAAI;CACJ,IAAI;EACF,WAAW,MAAM,QAAQ,SAAS,WAAW,OAAO,MAAM;GACxD,UAAU,OAAO;GACjB,KAAK,qBAAqB,OAAO,IAAI;EACvC,CAAC;CACH,SAAS,OAAO;EACd,IACE,YAAa,MAAgB,OAAO,KACpC,IAAI,OACF,uBAAuB,QAAQ,OAAO,WAAW,QAAQ,aAAa,KACxE,EAAE,KAAM,MAAgB,OAAO,GAC/B;GACA,MAAM,aAAc,MAAgB,QAAQ,MAC1C,IAAI,OACF,wBAAwB,QAAQ,OAAO,WAAW,QAAQ,aAAa,MACzE,CACF,IAAI;GACJ,MAAM,IAAI,MACR,eAAe,WAAW,4CACxB,eAAe,KAChB,uHACC,QAAQ,OAAO,SAAS,YAAY,WACpC,QAAQ,OAAO,SAAS,YAAY,UAChC;;;EAGZ,OAAO,SACK,IAER;EACF;EAEA,MAAM,IAAI,MACR,8CACE,eAAe,KAChB,YAAa,MAAgB,UAC5B,QAAQ,OAAO,SAAS,YAAY,WACpC,QAAQ,OAAO,SAAS,YAAY,UAChC;;;EAGV,OAAO,SACG,IAER;CACF;CAEA,OAAO;AACT;;;;;;;;;AAUA,eAAsB,QAIpB,SACA,OACA,SACkB;CAClB,IAAI;CACJ,IAAI,YAAY,KAAK,GACnB,iBAAiB,oBAAoB,KAAK;MAE1C,iBAAiB;CAGnB,MAAM,WAAW,MAAM,cACrB,SACA,gBACA,OACF;CAEA,IAAI,aAAa,eAAe;CAChC,IAAI,CAAC,YACH,aAAa;CAGf,MAAM,iBAAiB,SAAS,eAAe,SAAS,MAAM;CAC9D,IAAI,mBAAmB,QACrB,MAAM,IAAI,MACR,eAAe,WAAW,kCACxB,eAAe,KAChB,YACC,OAAO,KAAK,QAAQ,EAAE,WAAW,IAC7B,gFACE,eAAe,KAChB,kBAAkB,WAAW,oCAC9B,+CAA+C,OAAO,KACpD,QACF,EAAE,KACA,IACF,EAAE,iEAEV;CAGF,OAAO;AACT;;;;;;;;;AAUA,eAAsB,kBAGpB,SACA,OACA,SACe;CACf,OAAO,QACL,MAAM,QACJ,SACA,OACA,KAAK,SAAS,EACZ,SAAS,CACP,cAAc,SAAS;EACrB,YAAY;EACZ,OAAO;CACT,CAAC,CACH,EACF,CAAC,CACH,CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/schema",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.54",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
|
|
6
6
|
"keywords": [
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"typings": "dist/index.d.mts",
|
|
60
60
|
"files": ["dist"],
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@powerlines/core": "^0.48.
|
|
63
|
-
"@powerlines/deepkit": "^0.9.
|
|
64
|
-
"@powerlines/unplugin": "^0.0.
|
|
62
|
+
"@powerlines/core": "^0.48.14",
|
|
63
|
+
"@powerlines/deepkit": "^0.9.46",
|
|
64
|
+
"@powerlines/unplugin": "^0.0.62",
|
|
65
65
|
"@standard-schema/spec": "^1.1.0",
|
|
66
66
|
"@stryke/hash": "^0.13.30",
|
|
67
67
|
"@stryke/helpers": "^0.10.17",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"valibot": { "optional": true }
|
|
93
93
|
},
|
|
94
94
|
"publishConfig": { "access": "public" },
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "6bfbd00b03ce23f0d72eb154082d8faf08e93b12"
|
|
96
96
|
}
|