@powerlines/core 0.2.7 → 0.2.8

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.
@@ -42,7 +42,10 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
42
42
  ...result,
43
43
  id: `${prefix}${result.id}`
44
44
  };
45
- result = await ctx.resolve(id, importer, opts);
45
+ result = await ctx.resolve(id, importer, {
46
+ isFile: true,
47
+ ...opts
48
+ });
46
49
  if ((0, __stryke_type_checks_is_set_string.isSetString)(result)) return `${prefix}${result}`;
47
50
  else if ((0, __stryke_type_checks_is_set_object.isSetObject)(result)) return {
48
51
  ...result,
@@ -41,7 +41,10 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
41
41
  ...result,
42
42
  id: `${prefix}${result.id}`
43
43
  };
44
- result = await ctx.resolve(id, importer, opts);
44
+ result = await ctx.resolve(id, importer, {
45
+ isFile: true,
46
+ ...opts
47
+ });
45
48
  if (isSetString(result)) return `${prefix}${result}`;
46
49
  else if (isSetObject(result)) return {
47
50
  ...result,
@@ -1 +1 @@
1
- {"version":3,"file":"module-resolution.mjs","names":[],"sources":["../../../src/lib/unplugin/module-resolution.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 { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { LoadResult } from \"rollup\";\nimport type {\n ExternalIdResult,\n HookFnMap,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { UNSAFE_PluginContext } from \"../../types/_internal\";\nimport { PluginContext } from \"../../types/context\";\n\nexport interface CreateUnpluginModuleResolutionFunctionsOptions {\n /**\n * A prefix to apply to all resolved module IDs. This can be used to create virtual modules by prefixing them with a specific string (e.g., `\\0`).\n *\n * @remarks\n * If set to `false`, no prefix will be applied, and resolved module IDs will be returned as-is. By default, this is set to `\\0`, which is a common convention for virtual modules in Rollup and Vite plugins.\n *\n * @defaultValue \"\\\\0\"\n */\n prefix?: string | boolean;\n}\n\n/**\n * Creates the module resolution hook functions for a Powerlines unplugin plugin instance.\n *\n * @remarks\n * This includes the `resolveId` and `load` hooks.\n *\n * @see https://rollupjs.org/plugin-development/#resolveid\n * @see https://rollupjs.org/plugin-development/#load\n *\n * @param context - The plugin context.\n * @returns The module resolution hooks (`resolveId` and `load`).\n */\nexport function createUnpluginModuleResolutionFunctions<\n TContext extends PluginContext = PluginContext\n>(\n context: TContext,\n options: CreateUnpluginModuleResolutionFunctionsOptions = {}\n): Pick<HookFnMap, \"resolveId\" | \"load\"> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n\n let prefix = \"\";\n if (options.prefix === true) {\n prefix = \"\\0\";\n } else if (isSetString(options.prefix)) {\n prefix = options.prefix;\n }\n\n return {\n async resolveId(\n this: UnpluginBuildContext & UnpluginContext,\n id: string,\n importer?: string,\n opts: {\n isEntry: boolean;\n } = { isEntry: false }\n ): Promise<string | ExternalIdResult | null | undefined> {\n let result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n id,\n importer,\n opts\n );\n if (isSetString(result)) {\n return `${prefix}${result}`;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id: `${prefix}${result.id}`\n };\n }\n\n result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n id,\n importer,\n opts\n );\n if (isSetString(result)) {\n return `${prefix}${result}`;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id: `${prefix}${result.id}`\n };\n }\n\n result = await ctx.resolve(id, importer, opts);\n if (isSetString(result)) {\n return `${prefix}${result}`;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id: `${prefix}${result.id}`\n };\n }\n\n result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n id,\n importer,\n opts\n );\n if (isSetString(result)) {\n return `${prefix}${result}`;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id: `${prefix}${result.id}`\n };\n }\n\n return null;\n },\n async load(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<LoadResult | null | undefined> {\n const moduleId = prefix\n ? id.replace(new RegExp(`^${prefix}*`, \"g\"), \"\")\n : id;\n\n let result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n moduleId\n );\n if (result) {\n return result;\n }\n\n result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n moduleId\n );\n if (result) {\n return result;\n }\n\n result = await ctx.load(moduleId);\n if (result) {\n return result;\n }\n\n return ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n moduleId\n );\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsDA,SAAgB,wCAGd,SACA,UAA0D,EAAE,EACrB;CACvC,MAAM,MAAM;CAEZ,IAAI,SAAS;AACb,KAAI,QAAQ,WAAW,KACrB,UAAS;UACA,YAAY,QAAQ,OAAO,CACpC,UAAS,QAAQ;AAGnB,QAAO;EACL,MAAM,UAEJ,IACA,UACA,OAEI,EAAE,SAAS,OAAO,EACiC;GACvD,IAAI,SAAS,MAAM,IAAI,WAAW,SAChC,aACA;IACE,YAAY;IACZ,QAAQ;IACR,OAAO;IACR,EACD,IACA,UACA,KACD;AACD,OAAI,YAAY,OAAO,CACrB,QAAO,GAAG,SAAS;Y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olution.mjs","names":[],"sources":["../../../src/lib/unplugin/module-resolution.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 { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { LoadResult } from \"rollup\";\nimport type {\n ExternalIdResult,\n HookFnMap,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { UNSAFE_PluginContext } from \"../../types/_internal\";\nimport { PluginContext } from \"../../types/context\";\n\nexport interface CreateUnpluginModuleResolutionFunctionsOptions {\n /**\n * A prefix to apply to all resolved module IDs. This can be used to create virtual modules by prefixing them with a specific string (e.g., `\\0`).\n *\n * @remarks\n * If set to `false`, no prefix will be applied, and resolved module IDs will be returned as-is. By default, this is set to `\\0`, which is a common convention for virtual modules in Rollup and Vite plugins.\n *\n * @defaultValue \"\\\\0\"\n */\n prefix?: string | boolean;\n}\n\n/**\n * Creates the module resolution hook functions for a Powerlines unplugin plugin instance.\n *\n * @remarks\n * This includes the `resolveId` and `load` hooks.\n *\n * @see https://rollupjs.org/plugin-development/#resolveid\n * @see https://rollupjs.org/plugin-development/#load\n *\n * @param context - The plugin context.\n * @returns The module resolution hooks (`resolveId` and `load`).\n */\nexport function createUnpluginModuleResolutionFunctions<\n TContext extends PluginContext = PluginContext\n>(\n context: TContext,\n options: CreateUnpluginModuleResolutionFunctionsOptions = {}\n): Pick<HookFnMap, \"resolveId\" | \"load\"> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n\n let prefix = \"\";\n if (options.prefix === true) {\n prefix = \"\\0\";\n } else if (isSetString(options.prefix)) {\n prefix = options.prefix;\n }\n\n return {\n async resolveId(\n this: UnpluginBuildContext & UnpluginContext,\n id: string,\n importer?: string,\n opts: {\n isEntry: boolean;\n } = { isEntry: false }\n ): Promise<string | ExternalIdResult | null | undefined> {\n let result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n id,\n importer,\n opts\n );\n if (isSetString(result)) {\n return `${prefix}${result}`;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id: `${prefix}${result.id}`\n };\n }\n\n result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n id,\n importer,\n opts\n );\n if (isSetString(result)) {\n return `${prefix}${result}`;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id: `${prefix}${result.id}`\n };\n }\n\n result = await ctx.resolve(id, importer, { isFile: true, ...opts });\n if (isSetString(result)) {\n return `${prefix}${result}`;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id: `${prefix}${result.id}`\n };\n }\n\n result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n id,\n importer,\n opts\n );\n if (isSetString(result)) {\n return `${prefix}${result}`;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id: `${prefix}${result.id}`\n };\n }\n\n return null;\n },\n async load(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<LoadResult | null | undefined> {\n const moduleId = prefix\n ? id.replace(new RegExp(`^${prefix}*`, \"g\"), \"\")\n : id;\n\n let result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n moduleId\n );\n if (result) {\n return result;\n }\n\n result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n moduleId\n );\n if (result) {\n return result;\n }\n\n result = await ctx.load(moduleId);\n if (result) {\n return result;\n }\n\n return ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n moduleId\n );\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsDA,SAAgB,wCAGd,SACA,UAA0D,EAAE,EACrB;CACvC,MAAM,MAAM;CAEZ,IAAI,SAAS;AACb,KAAI,QAAQ,WAAW,KACrB,UAAS;UACA,YAAY,QAAQ,OAAO,CACpC,UAAS,QAAQ;AAGnB,QAAO;EACL,MAAM,UAEJ,IACA,UACA,OAEI,EAAE,SAAS,OAAO,EACiC;GACvD,IAAI,SAAS,MAAM,IAAI,WAAW,SAChC,aACA;IACE,YAAY;IACZ,QAAQ;IACR,OAAO;IACR,EACD,IACA,UACA,KACD;AACD,OAAI,YAAY,OAAO,CACrB,QAAO,GAAG,SAAS;YACV,YAAY,OAAO,CAC5B,QAAO;IACL,GAAG;IACH,IAAI,GAAG,SAAS,OAAO;IACxB;AAGH,YAAS,MAAM,IAAI,WAAW,SAC5B,aACA;IACE,YAAY;IACZ,QAAQ;IACR,OAAO;IACR,EACD,IACA,UACA,KACD;AACD,OAAI,YAAY,OAAO,CACrB,QAAO,GAAG,SAAS;YACV,YAAY,OAAO,CAC5B,QAAO;IACL,GAAG;IACH,IAAI,GAAG,SAAS,OAAO;IACxB;AAGH,YAAS,MAAM,IAAI,QAAQ,IAAI,UAAU;IAAE,QAAQ;IAAM,GAAG;IAAM,CAAC;AACnE,OAAI,YAAY,OAAO,CACrB,QAAO,GAAG,SAAS;YACV,YAAY,OAAO,CAC5B,QAAO;IACL,GAAG;IACH,IAAI,GAAG,SAAS,OAAO;IACxB;AAGH,YAAS,MAAM,IAAI,WAAW,SAC5B,aACA;IACE,YAAY;IACZ,QAAQ;IACR,OAAO;IACR,EACD,IACA,UACA,KACD;AACD,OAAI,YAAY,OAAO,CACrB,QAAO,GAAG,SAAS;YACV,YAAY,OAAO,CAC5B,QAAO;IACL,GAAG;IACH,IAAI,GAAG,SAAS,OAAO;IACxB;AAGH,UAAO;;EAET,MAAM,KAEJ,IACwC;GACxC,MAAM,WAAW,SACb,GAAG,QAAQ,IAAI,OAAO,IAAI,OAAO,IAAI,IAAI,EAAE,GAAG,GAC9C;GAEJ,IAAI,SAAS,MAAM,IAAI,WAAW,SAChC,QACA;IACE,YAAY;IACZ,QAAQ;IACR,OAAO;IACR,EACD,SACD;AACD,OAAI,OACF,QAAO;AAGT,YAAS,MAAM,IAAI,WAAW,SAC5B,QACA;IACE,YAAY;IACZ,QAAQ;IACR,OAAO;IACR,EACD,SACD;AACD,OAAI,OACF,QAAO;AAGT,YAAS,MAAM,IAAI,KAAK,SAAS;AACjC,OAAI,OACF,QAAO;AAGT,UAAO,IAAI,WAAW,SACpB,QACA;IACE,YAAY;IACZ,QAAQ;IACR,OAAO;IACR,EACD,SACD;;EAEJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/core",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "private": false,
5
5
  "description": "An internal core package for Powerlines - please use the `powerlines` package for public usage.",
6
6
  "homepage": "https://stormsoftware.com",
@@ -495,15 +495,15 @@
495
495
  "dependencies": {
496
496
  "@storm-software/config": "^1.135.22",
497
497
  "@storm-software/config-tools": "^1.189.21",
498
- "@stryke/convert": "^0.6.50",
499
- "@stryke/fs": "^0.33.54",
500
- "@stryke/hash": "^0.13.7",
501
- "@stryke/helpers": "^0.10.0",
502
- "@stryke/json": "^0.14.4",
503
- "@stryke/path": "^0.26.16",
504
- "@stryke/string-format": "^0.17.0",
505
- "@stryke/type-checks": "^0.5.35",
506
- "@stryke/unique-id": "^0.3.65",
498
+ "@stryke/convert": "^0.6.51",
499
+ "@stryke/fs": "^0.33.55",
500
+ "@stryke/hash": "^0.13.8",
501
+ "@stryke/helpers": "^0.10.1",
502
+ "@stryke/json": "^0.14.5",
503
+ "@stryke/path": "^0.26.17",
504
+ "@stryke/string-format": "^0.17.1",
505
+ "@stryke/type-checks": "^0.5.36",
506
+ "@stryke/unique-id": "^0.3.66",
507
507
  "c12": "^3.3.3",
508
508
  "chalk": "5.6.2",
509
509
  "compatx": "^0.2.0",
@@ -516,7 +516,7 @@
516
516
  },
517
517
  "devDependencies": {
518
518
  "@storm-software/testing-tools": "^1.119.96",
519
- "@stryke/types": "^0.10.49",
519
+ "@stryke/types": "^0.10.50",
520
520
  "@types/diff-match-patch": "^1.0.36",
521
521
  "@types/node": "^25.3.5",
522
522
  "@types/semver": "^7.7.1",
@@ -524,5 +524,5 @@
524
524
  "typescript": "^5.9.3"
525
525
  },
526
526
  "publishConfig": { "access": "public" },
527
- "gitHead": "3624394803d73dc4155d609ca164dc58b2f20c3c"
527
+ "gitHead": "6e7c6508c165d754b37b0649eb1cd3a6d44c04b2"
528
528
  }