@powerlines/core 0.10.1 → 0.11.0
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/lib/unplugin/module-resolution.cjs +4 -2
- package/dist/lib/unplugin/module-resolution.d.cts +8 -0
- package/dist/lib/unplugin/module-resolution.d.cts.map +1 -1
- package/dist/lib/unplugin/module-resolution.d.mts +8 -0
- package/dist/lib/unplugin/module-resolution.d.mts.map +1 -1
- package/dist/lib/unplugin/module-resolution.mjs +3 -2
- package/dist/lib/unplugin/module-resolution.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
4
|
+
let defu = require("defu");
|
|
5
|
+
defu = require_runtime.__toESM(defu);
|
|
4
6
|
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
5
7
|
|
|
6
8
|
//#region src/lib/unplugin/module-resolution.ts
|
|
@@ -45,10 +47,10 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
45
47
|
...result,
|
|
46
48
|
id: result.virtual && options.prefix !== false ? `${VIRTUAL_MODULE_PREFIX}${result.id}` : result.id
|
|
47
49
|
};
|
|
48
|
-
result = await ctx.resolve(normalizedId, normalizedImporter, {
|
|
50
|
+
result = await ctx.resolve(normalizedId, normalizedImporter, (0, defu.default)(options.overrides ?? {}, {
|
|
49
51
|
isFile: true,
|
|
50
52
|
...opts
|
|
51
|
-
});
|
|
53
|
+
}));
|
|
52
54
|
if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
53
55
|
...result,
|
|
54
56
|
id: result.virtual && options.prefix !== false ? `${VIRTUAL_MODULE_PREFIX}${result.id}` : result.id
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ResolveOptions } from "../../types/fs.cjs";
|
|
1
2
|
import { PluginContext } from "../../types/context.cjs";
|
|
2
3
|
import { UnpluginOptions } from "unplugin";
|
|
3
4
|
|
|
@@ -13,6 +14,13 @@ interface CreateUnpluginModuleResolutionFunctionsOptions {
|
|
|
13
14
|
* @defaultValue true
|
|
14
15
|
*/
|
|
15
16
|
prefix?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Optional overrides for the module resolution configuration.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* This allows you to customize the behavior of the module resolution hooks by providing specific configuration options.
|
|
22
|
+
*/
|
|
23
|
+
overrides?: Partial<ResolveOptions>;
|
|
16
24
|
}
|
|
17
25
|
/**
|
|
18
26
|
* Creates the module resolution hook functions for a Powerlines unplugin plugin instance.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-resolution.d.cts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"module-resolution.d.cts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"mappings":";;;;;UA+BiB,8CAAA;;AAAjB;;;;;;;;EAUE,MAAA;EAQkC;AAmBpC;;;;;EAnBE,SAAA,GAAY,OAAA,CAAQ,cAAA;AAAA;;;;;;;;;;;;;;iBAmBN,uCAAA,kBACG,aAAA,GAAgB,aAAA,CAAA,CAEjC,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,8CAAA,GACR,IAAA,CAAK,eAAA;AAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ResolveOptions } from "../../types/fs.mjs";
|
|
1
2
|
import { PluginContext } from "../../types/context.mjs";
|
|
2
3
|
import { UnpluginOptions } from "unplugin";
|
|
3
4
|
|
|
@@ -13,6 +14,13 @@ interface CreateUnpluginModuleResolutionFunctionsOptions {
|
|
|
13
14
|
* @defaultValue true
|
|
14
15
|
*/
|
|
15
16
|
prefix?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Optional overrides for the module resolution configuration.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* This allows you to customize the behavior of the module resolution hooks by providing specific configuration options.
|
|
22
|
+
*/
|
|
23
|
+
overrides?: Partial<ResolveOptions>;
|
|
16
24
|
}
|
|
17
25
|
/**
|
|
18
26
|
* Creates the module resolution hook functions for a Powerlines unplugin plugin instance.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-resolution.d.mts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"module-resolution.d.mts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"mappings":";;;;;UA+BiB,8CAAA;;AAAjB;;;;;;;;EAUE,MAAA;EAQkC;AAmBpC;;;;;EAnBE,SAAA,GAAY,OAAA,CAAQ,cAAA;AAAA;;;;;;;;;;;;;;iBAmBN,uCAAA,kBACG,aAAA,GAAgB,aAAA,CAAA,CAEjC,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,8CAAA,GACR,IAAA,CAAK,eAAA;AAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
2
|
+
import defu from "defu";
|
|
2
3
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
3
4
|
|
|
4
5
|
//#region src/lib/unplugin/module-resolution.ts
|
|
@@ -43,10 +44,10 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
43
44
|
...result,
|
|
44
45
|
id: result.virtual && options.prefix !== false ? `${VIRTUAL_MODULE_PREFIX}${result.id}` : result.id
|
|
45
46
|
};
|
|
46
|
-
result = await ctx.resolve(normalizedId, normalizedImporter, {
|
|
47
|
+
result = await ctx.resolve(normalizedId, normalizedImporter, defu(options.overrides ?? {}, {
|
|
47
48
|
isFile: true,
|
|
48
49
|
...opts
|
|
49
|
-
});
|
|
50
|
+
}));
|
|
50
51
|
if (isSetObject(result)) return {
|
|
51
52
|
...result,
|
|
52
53
|
id: result.virtual && options.prefix !== false ? `${VIRTUAL_MODULE_PREFIX}${result.id}` : result.id
|
|
@@ -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 UnpluginBuildContext,\n UnpluginContext,\n UnpluginOptions\n} from \"unplugin\";\nimport { UNSAFE_PluginContext } from \"../../types/_internal\";\nimport { PluginContext, ResolveResult } from \"../../types/context\";\n\nexport interface CreateUnpluginModuleResolutionFunctionsOptions {\n /**\n * An indicator of whether to prefix virtual module IDs with a specific string. This is useful for ensuring that virtual modules are only processed by the plugin and not by other plugins or the bundler itself.\n *\n * @remarks\n * - If set to `true`, virtual module IDs will be prefixed with the string `__powerlines-virtual:`.\n * - If set to `false`, no prefix will be added to virtual module IDs.\n *\n * @defaultValue true\n */\n prefix?: boolean;\n}\n\nconst VIRTUAL_MODULE_PREFIX = \"__powerlines-virtual:\";\nconst VIRTUAL_MODULE_PREFIX_REGEX = /^__powerlines-virtual:/;\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 * @param options - Options for creating the module resolution functions.\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<UnpluginOptions, \"resolveId\" | \"load\"> {\n const ctx = context as unknown as UNSAFE_PluginContext;\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 | ResolveResult | null | undefined> {\n const normalizedId = id.replace(VIRTUAL_MODULE_PREFIX_REGEX, \"\");\n const normalizedImporter = importer\n ? importer.replace(VIRTUAL_MODULE_PREFIX_REGEX, \"\")\n : undefined;\n\n let result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && options.prefix !== false\n ? `${VIRTUAL_MODULE_PREFIX}${result.id}`\n : 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 normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && options.prefix !== false\n ? `${VIRTUAL_MODULE_PREFIX}${result.id}`\n : result.id\n };\n }\n\n result = await ctx.resolve(normalizedId
|
|
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 defu from \"defu\";\nimport { LoadResult } from \"rollup\";\nimport type {\n UnpluginBuildContext,\n UnpluginContext,\n UnpluginOptions\n} from \"unplugin\";\nimport { UNSAFE_PluginContext } from \"../../types/_internal\";\nimport { PluginContext, ResolveResult } from \"../../types/context\";\nimport { ResolveOptions } from \"../../types/fs\";\n\nexport interface CreateUnpluginModuleResolutionFunctionsOptions {\n /**\n * An indicator of whether to prefix virtual module IDs with a specific string. This is useful for ensuring that virtual modules are only processed by the plugin and not by other plugins or the bundler itself.\n *\n * @remarks\n * - If set to `true`, virtual module IDs will be prefixed with the string `__powerlines-virtual:`.\n * - If set to `false`, no prefix will be added to virtual module IDs.\n *\n * @defaultValue true\n */\n prefix?: boolean;\n\n /**\n * Optional overrides for the module resolution configuration.\n *\n * @remarks\n * This allows you to customize the behavior of the module resolution hooks by providing specific configuration options.\n */\n overrides?: Partial<ResolveOptions>;\n}\n\nconst VIRTUAL_MODULE_PREFIX = \"__powerlines-virtual:\";\nconst VIRTUAL_MODULE_PREFIX_REGEX = /^__powerlines-virtual:/;\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 * @param options - Options for creating the module resolution functions.\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<UnpluginOptions, \"resolveId\" | \"load\"> {\n const ctx = context as unknown as UNSAFE_PluginContext;\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 | ResolveResult | null | undefined> {\n const normalizedId = id.replace(VIRTUAL_MODULE_PREFIX_REGEX, \"\");\n const normalizedImporter = importer\n ? importer.replace(VIRTUAL_MODULE_PREFIX_REGEX, \"\")\n : undefined;\n\n let result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && options.prefix !== false\n ? `${VIRTUAL_MODULE_PREFIX}${result.id}`\n : 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 normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && options.prefix !== false\n ? `${VIRTUAL_MODULE_PREFIX}${result.id}`\n : result.id\n };\n }\n\n result = await ctx.resolve(\n normalizedId,\n normalizedImporter,\n defu(options.overrides ?? {}, {\n isFile: true,\n ...opts\n })\n );\n if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && options.prefix !== false\n ? `${VIRTUAL_MODULE_PREFIX}${result.id}`\n : 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 normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && options.prefix !== false\n ? `${VIRTUAL_MODULE_PREFIX}${result.id}`\n : result.id\n };\n }\n\n return null;\n },\n load: {\n filter:\n options.prefix !== false\n ? {\n id: {\n include: [VIRTUAL_MODULE_PREFIX_REGEX]\n }\n }\n : undefined,\n async handler(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<LoadResult | null | undefined> {\n const normalizedId = id.replace(VIRTUAL_MODULE_PREFIX_REGEX, \"\");\n\n let result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n normalizedId\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 normalizedId\n );\n if (result) {\n return result;\n }\n\n result = await ctx.load(normalizedId);\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 normalizedId\n );\n }\n }\n };\n}\n"],"mappings":";;;;;AAoDA,MAAM,wBAAwB;AAC9B,MAAM,8BAA8B;;;;;;;;;;;;;;AAepC,SAAgB,wCAGd,SACA,UAA0D,EAAE,EACf;CAC7C,MAAM,MAAM;AAEZ,QAAO;EACL,MAAM,UAEJ,IACA,UACA,OAEI,EAAE,SAAS,OAAO,EAC8B;GACpD,MAAM,eAAe,GAAG,QAAQ,6BAA6B,GAAG;GAChE,MAAM,qBAAqB,WACvB,SAAS,QAAQ,6BAA6B,GAAG,GACjD;GAEJ,IAAI,SAAS,MAAM,IAAI,WAAW,SAChC,aACA;IACE,YAAY;IACZ,QAAQ;IACR,OAAO;IACR,EACD,cACA,oBACA,KACD;AACD,OAAI,YAAY,OAAO,CACrB,QAAO;YACE,YAAY,OAAO,CAC5B,QAAO;IACL,GAAG;IACH,IACE,OAAO,WAAW,QAAQ,WAAW,QACjC,GAAG,wBAAwB,OAAO,OAClC,OAAO;IACd;AAGH,YAAS,MAAM,IAAI,WAAW,SAC5B,aACA;IACE,YAAY;IACZ,QAAQ;IACR,OAAO;IACR,EACD,cACA,oBACA,KACD;AACD,O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1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
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",
|
|
@@ -526,5 +526,5 @@
|
|
|
526
526
|
"typescript": "^5.9.3"
|
|
527
527
|
},
|
|
528
528
|
"publishConfig": { "access": "public" },
|
|
529
|
-
"gitHead": "
|
|
529
|
+
"gitHead": "d500b0c65a5440cf3a483c6e1b329640dba89568"
|
|
530
530
|
}
|