@powerlines/schema 0.11.51 → 0.11.53

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 CHANGED
@@ -28,7 +28,6 @@ async function bundle(context, file, options = {}) {
28
28
  ]);
29
29
  const plugins = await Promise.resolve(options.plugins);
30
30
  const result = await (0, rolldown.build)({
31
- bundle: true,
32
31
  platform: "node",
33
32
  ...(0, _powerlines_unplugin_rolldown.resolveOptions)(context),
34
33
  ...userOptions,
package/dist/bundle.mjs CHANGED
@@ -26,7 +26,6 @@ async function bundle(context, file, options = {}) {
26
26
  ]);
27
27
  const plugins = await Promise.resolve(options.plugins);
28
28
  const result = await build({
29
- bundle: true,
30
29
  platform: "node",
31
30
  ...resolveOptions(context),
32
31
  ...userOptions,
@@ -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/rolldown\";\nimport { toArray } from \"@stryke/convert/to-array\";\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, OutputChunk } from \"rolldown\";\nimport { build } from \"rolldown\";\nimport { createRolldownPlugin } from \"unplugin\";\n\nexport type BundleOptions = DeepPartial<\n Omit<BuildOptions, \"input\" | \"write\">\n> & {\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 Rolldown 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<OutputChunk> {\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 userOptions = omit(options, [\"name\", \"resolve\", \"plugins\"]);\n const plugins = await Promise.resolve(options.plugins);\n\n const resolvedOptions = resolveOptions(context);\n\n const result = await build({\n bundle: true,\n platform: \"node\",\n ...resolvedOptions,\n ...userOptions,\n logLevel: \"silent\",\n output: {\n dir: context.config.output.path,\n format: \"es\",\n sourcemap: false,\n codeSplitting: false,\n minify: false,\n keepNames: true,\n exports: \"named\",\n ...userOptions.output\n },\n input: [path],\n write: false,\n plugins: [\n ...(plugins ? toArray(plugins) : []),\n createRolldownPlugin(\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 ].filter(Boolean)\n } as BuildOptions);\n if (!result.output || result.output.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 if (result.output.length > 1) {\n context.warn(\n `Multiple output files generated for \"${\n file\n }\". Only the first file will be used. Please check the configuration to ensure only one output file is generated.`\n );\n }\n\n return result.output[0];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiDA,eAAsB,OACpB,SACA,MACA,UAAyB,CAAC,GACJ;CACtB,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,cAAc,KAAK,SAAS;EAAC;EAAQ;EAAW;CAAS,CAAC;CAChE,MAAM,UAAU,MAAM,QAAQ,QAAQ,QAAQ,OAAO;CAIrD,MAAM,SAAS,MAAM,MAAM;EACzB,QAAQ;EACR,UAAU;EACV,GALsB,eAAe,OAKpB;EACjB,GAAG;EACH,UAAU;EACV,QAAQ;GACN,KAAK,QAAQ,OAAO,OAAO;GAC3B,QAAQ;GACR,WAAW;GACX,eAAe;GACf,QAAQ;GACR,WAAW;GACX,SAAS;GACT,GAAG,YAAY;EACjB;EACA,OAAO,CAAC,IAAI;EACZ,OAAO;EACP,SAAS,CACP,GAAI,UAAU,QAAQ,OAAO,IAAI,CAAC,GAClC,qBACE,uBAAuB,SAAS;GAC9B,MAAM,QAAQ,QAAQ,GAAG,aAAa,IAAI,EAAE;GAC5C,QAAQ;GACR,WAAW,KACT,QAAQ,WAAW,CAAC,GACpB,EAAE,uBAAuB,MAAM,GAC/B,QAAQ,OAAO,OACjB;GACA,oBAAoB;EACtB,CAAC,CACH,EAAE,CACJ,EAAE,OAAO,OAAO;CAClB,CAAiB;CACjB,IAAI,CAAC,OAAO,UAAU,OAAO,OAAO,WAAW,GAC7C,MAAM,IAAI,MACR,iCACE,KACD,gDACH;CAEF,IAAI,OAAO,OAAO,SAAS,GACzB,QAAQ,KACN,wCACE,KACD,iHACH;CAGF,OAAO,OAAO,OAAO;AACvB"}
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/rolldown\";\nimport { toArray } from \"@stryke/convert/to-array\";\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, OutputChunk } from \"rolldown\";\nimport { build } from \"rolldown\";\nimport { createRolldownPlugin } from \"unplugin\";\n\nexport type BundleOptions = DeepPartial<\n Omit<BuildOptions, \"input\" | \"write\">\n> & {\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 Rolldown 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<OutputChunk> {\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 userOptions = omit(options, [\"name\", \"resolve\", \"plugins\"]);\n const plugins = await Promise.resolve(options.plugins);\n\n const resolvedOptions = resolveOptions(context);\n\n const result = await build({\n platform: \"node\",\n ...resolvedOptions,\n ...userOptions,\n logLevel: \"silent\",\n output: {\n dir: context.config.output.path,\n format: \"es\",\n sourcemap: false,\n codeSplitting: false,\n minify: false,\n keepNames: true,\n exports: \"named\",\n ...userOptions.output\n },\n input: [path],\n write: false,\n plugins: [\n ...(plugins ? toArray(plugins) : []),\n createRolldownPlugin(\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 ].filter(Boolean)\n } as BuildOptions);\n if (!result.output || result.output.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 if (result.output.length > 1) {\n context.warn(\n `Multiple output files generated for \"${\n file\n }\". Only the first file will be used. Please check the configuration to ensure only one output file is generated.`\n );\n }\n\n return result.output[0];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiDA,eAAsB,OACpB,SACA,MACA,UAAyB,CAAC,GACJ;CACtB,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,cAAc,KAAK,SAAS;EAAC;EAAQ;EAAW;CAAS,CAAC;CAChE,MAAM,UAAU,MAAM,QAAQ,QAAQ,QAAQ,OAAO;CAIrD,MAAM,SAAS,MAAM,MAAM;EACzB,UAAU;EACV,GAJsB,eAAe,OAIpB;EACjB,GAAG;EACH,UAAU;EACV,QAAQ;GACN,KAAK,QAAQ,OAAO,OAAO;GAC3B,QAAQ;GACR,WAAW;GACX,eAAe;GACf,QAAQ;GACR,WAAW;GACX,SAAS;GACT,GAAG,YAAY;EACjB;EACA,OAAO,CAAC,IAAI;EACZ,OAAO;EACP,SAAS,CACP,GAAI,UAAU,QAAQ,OAAO,IAAI,CAAC,GAClC,qBACE,uBAAuB,SAAS;GAC9B,MAAM,QAAQ,QAAQ,GAAG,aAAa,IAAI,EAAE;GAC5C,QAAQ;GACR,WAAW,KACT,QAAQ,WAAW,CAAC,GACpB,EAAE,uBAAuB,MAAM,GAC/B,QAAQ,OAAO,OACjB;GACA,oBAAoB;EACtB,CAAC,CACH,EAAE,CACJ,EAAE,OAAO,OAAO;CAClB,CAAiB;CACjB,IAAI,CAAC,OAAO,UAAU,OAAO,OAAO,WAAW,GAC7C,MAAM,IAAI,MACR,iCACE,KACD,gDACH;CAEF,IAAI,OAAO,OAAO,SAAS,GACzB,QAAQ,KACN,wCACE,KACD,iHACH;CAGF,OAAO,OAAO,OAAO;AACvB"}
package/dist/resolve.cjs CHANGED
@@ -24,10 +24,7 @@ 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.code, {
28
- filename: result.fileName,
29
- ext: (0, _stryke_path_find.findFileDotExtension)(result.fileName)
30
- });
27
+ resolved = await context.resolver.evalModule(result.code, { ext: (0, _stryke_path_find.findFileDotExtension)(result.fileName) });
31
28
  } catch (error) {
32
29
  if ((0, _stryke_type_checks_is_set_string.isSetString)(error.message) && new RegExp(`Cannot find module '${context.config.framework?.name || "powerlines"}:.*'`).test(error.message)) {
33
30
  const moduleName = error.message.match(new RegExp(`Cannot find module '(${context.config.framework?.name || "powerlines"}:.*)'`))?.[1];
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.cts","names":[],"sources":["../src/resolve.ts"],"mappings":";;;;;;;;AAqCA;;;;;;iBAAsB,aAAA,2BAEH,iBAAA,GAAoB,iBAAA,CAAA,CAErC,OAAA,EAAS,QAAA,EACT,IAAA,EAAM,uBAAA,EACN,SAAA,GAAY,aAAA,GACX,OAAA,CAAQ,OAAA;;;;;;;;;iBAyEW,OAAA,2BAEH,iBAAA,GAAoB,iBAAA,CAAA,CAErC,OAAA,EAAS,QAAA,EACT,KAAA,EAAO,uBAAA,EACP,OAAA,GAAU,aAAA,GACT,OAAA,CAAQ,OAAA;;;;;;;;;iBAiDW,iBAAA,kBACH,aAAA,GAAgB,aAAA,CAAA,CAEjC,OAAA,EAAS,QAAA,EACT,KAAA,EAAO,uBAAA,EACP,OAAA,GAAU,aAAA,GACT,OAAA,CAAQ,IAAA"}
1
+ {"version":3,"file":"resolve.d.cts","names":[],"sources":["../src/resolve.ts"],"mappings":";;;;;;;;AAqCA;;;;;;iBAAsB,aAAA,2BAEH,iBAAA,GAAoB,iBAAA,CAAA,CAErC,OAAA,EAAS,QAAA,EACT,IAAA,EAAM,uBAAA,EACN,SAAA,GAAY,aAAA,GACX,OAAA,CAAQ,OAAA;;;;;;;;;iBAwEW,OAAA,2BAEH,iBAAA,GAAoB,iBAAA,CAAA,CAErC,OAAA,EAAS,QAAA,EACT,KAAA,EAAO,uBAAA,EACP,OAAA,GAAU,aAAA,GACT,OAAA,CAAQ,OAAA;;;;;;;;;iBAiDW,iBAAA,kBACH,aAAA,GAAgB,aAAA,CAAA,CAEjC,OAAA,EAAS,QAAA,EACT,KAAA,EAAO,uBAAA,EACP,OAAA,GAAU,aAAA,GACT,OAAA,CAAQ,IAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.mts","names":[],"sources":["../src/resolve.ts"],"mappings":";;;;;;;;AAqCA;;;;;;iBAAsB,aAAA,2BAEH,iBAAA,GAAoB,iBAAA,CAAA,CAErC,OAAA,EAAS,QAAA,EACT,IAAA,EAAM,uBAAA,EACN,SAAA,GAAY,aAAA,GACX,OAAA,CAAQ,OAAA;;;;;;;;;iBAyEW,OAAA,2BAEH,iBAAA,GAAoB,iBAAA,CAAA,CAErC,OAAA,EAAS,QAAA,EACT,KAAA,EAAO,uBAAA,EACP,OAAA,GAAU,aAAA,GACT,OAAA,CAAQ,OAAA;;;;;;;;;iBAiDW,iBAAA,kBACH,aAAA,GAAgB,aAAA,CAAA,CAEjC,OAAA,EAAS,QAAA,EACT,KAAA,EAAO,uBAAA,EACP,OAAA,GAAU,aAAA,GACT,OAAA,CAAQ,IAAA"}
1
+ {"version":3,"file":"resolve.d.mts","names":[],"sources":["../src/resolve.ts"],"mappings":";;;;;;;;AAqCA;;;;;;iBAAsB,aAAA,2BAEH,iBAAA,GAAoB,iBAAA,CAAA,CAErC,OAAA,EAAS,QAAA,EACT,IAAA,EAAM,uBAAA,EACN,SAAA,GAAY,aAAA,GACX,OAAA,CAAQ,OAAA;;;;;;;;;iBAwEW,OAAA,2BAEH,iBAAA,GAAoB,iBAAA,CAAA,CAErC,OAAA,EAAS,QAAA,EACT,KAAA,EAAO,uBAAA,EACP,OAAA,GAAU,aAAA,GACT,OAAA,CAAQ,OAAA;;;;;;;;;iBAiDW,iBAAA,kBACH,aAAA,GAAgB,aAAA,CAAA,CAEjC,OAAA,EAAS,QAAA,EACT,KAAA,EAAO,uBAAA,EACP,OAAA,GAAU,aAAA,GACT,OAAA,CAAQ,IAAA"}
package/dist/resolve.mjs CHANGED
@@ -22,10 +22,7 @@ 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.code, {
26
- filename: result.fileName,
27
- ext: findFileDotExtension(result.fileName)
28
- });
25
+ resolved = await context.resolver.evalModule(result.code, { ext: findFileDotExtension(result.fileName) });
29
26
  } catch (error) {
30
27
  if (isSetString(error.message) && new RegExp(`Cannot find module '${context.config.framework?.name || "powerlines"}:.*'`).test(error.message)) {
31
28
  const moduleName = error.message.match(new RegExp(`Cannot find module '(${context.config.framework?.name || "powerlines"}:.*)'`))?.[1];
@@ -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 { rolldownPlugin } from \"@powerlines/deepkit/rolldown-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.code, {\n filename: result.fileName,\n ext: findFileDotExtension(result.fileName)\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.code}`\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.code}`\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 rolldownPlugin(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,QAAQ;EAC3C,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,eAAe,SAAS;EACtB,YAAY;EACZ,OAAO;CACT,CAAC,CACH,EACF,CAAC,CACH,CACF;AACF"}
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 { rolldownPlugin } from \"@powerlines/deepkit/rolldown-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.code, {\n ext: findFileDotExtension(result.fileName)\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.code}`\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.code}`\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 rolldownPlugin(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,EACxD,KAAK,qBAAqB,OAAO,QAAQ,EAC3C,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,eAAe,SAAS;EACtB,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.51",
3
+ "version": "0.11.53",
4
4
  "private": false,
5
5
  "description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
6
6
  "keywords": [
@@ -59,17 +59,17 @@
59
59
  "typings": "dist/index.d.mts",
60
60
  "files": ["dist"],
61
61
  "dependencies": {
62
- "@powerlines/core": "^0.48.12",
63
- "@powerlines/deepkit": "^0.9.44",
64
- "@powerlines/unplugin": "^0.0.60",
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
- "@stryke/hash": "^0.13.29",
67
- "@stryke/helpers": "^0.10.16",
68
- "@stryke/json": "^0.15.0",
69
- "@stryke/path": "^0.29.3",
70
- "@stryke/type-checks": "^0.6.9",
71
- "@stryke/types": "^0.12.4",
72
- "@stryke/zod": "^0.3.22",
66
+ "@stryke/hash": "^0.13.30",
67
+ "@stryke/helpers": "^0.10.17",
68
+ "@stryke/json": "^0.15.1",
69
+ "@stryke/path": "^0.29.4",
70
+ "@stryke/type-checks": "^0.6.10",
71
+ "@stryke/types": "^0.12.5",
72
+ "@stryke/zod": "^0.3.23",
73
73
  "@valibot/to-json-schema": "^1.7.0",
74
74
  "ajv": "^8.20.0",
75
75
  "ajv-formats": "^3.0.1",
@@ -92,5 +92,5 @@
92
92
  "valibot": { "optional": true }
93
93
  },
94
94
  "publishConfig": { "access": "public" },
95
- "gitHead": "50107ef1a62407559a697891a13b7b3b9324f122"
95
+ "gitHead": "bb2fced8516bd420e927eb1b78e1ccfcf6d9bf02"
96
96
  }