@powerlines/core 0.0.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.
- package/LICENSE +201 -0
- package/README.md +1 -0
- package/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/index.cjs +65 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.mts +25 -0
- package/dist/index.mjs +22 -0
- package/dist/lib/config.cjs +90 -0
- package/dist/lib/config.cjs.map +1 -0
- package/dist/lib/config.d.cts +40 -0
- package/dist/lib/config.d.cts.map +1 -0
- package/dist/lib/config.d.mts +40 -0
- package/dist/lib/config.d.mts.map +1 -0
- package/dist/lib/config.mjs +86 -0
- package/dist/lib/config.mjs.map +1 -0
- package/dist/lib/constants/environments.cjs +17 -0
- package/dist/lib/constants/environments.cjs.map +1 -0
- package/dist/lib/constants/environments.d.cts +10 -0
- package/dist/lib/constants/environments.d.cts.map +1 -0
- package/dist/lib/constants/environments.d.mts +10 -0
- package/dist/lib/constants/environments.d.mts.map +1 -0
- package/dist/lib/constants/environments.mjs +11 -0
- package/dist/lib/constants/environments.mjs.map +1 -0
- package/dist/lib/constants/index.cjs +11 -0
- package/dist/lib/constants/index.d.cts +3 -0
- package/dist/lib/constants/index.d.mts +3 -0
- package/dist/lib/constants/index.mjs +4 -0
- package/dist/lib/constants/meta.cjs +9 -0
- package/dist/lib/constants/meta.cjs.map +1 -0
- package/dist/lib/constants/meta.d.cts +6 -0
- package/dist/lib/constants/meta.d.cts.map +1 -0
- package/dist/lib/constants/meta.d.mts +6 -0
- package/dist/lib/constants/meta.d.mts.map +1 -0
- package/dist/lib/constants/meta.mjs +7 -0
- package/dist/lib/constants/meta.mjs.map +1 -0
- package/dist/lib/entry.cjs +127 -0
- package/dist/lib/entry.cjs.map +1 -0
- package/dist/lib/entry.d.cts +47 -0
- package/dist/lib/entry.d.cts.map +1 -0
- package/dist/lib/entry.d.mts +48 -0
- package/dist/lib/entry.d.mts.map +1 -0
- package/dist/lib/entry.mjs +120 -0
- package/dist/lib/entry.mjs.map +1 -0
- package/dist/lib/index.cjs +50 -0
- package/dist/lib/index.d.cts +14 -0
- package/dist/lib/index.d.mts +16 -0
- package/dist/lib/index.mjs +17 -0
- package/dist/lib/logger.cjs +59 -0
- package/dist/lib/logger.cjs.map +1 -0
- package/dist/lib/logger.d.cts +23 -0
- package/dist/lib/logger.d.cts.map +1 -0
- package/dist/lib/logger.d.mts +24 -0
- package/dist/lib/logger.d.mts.map +1 -0
- package/dist/lib/logger.mjs +56 -0
- package/dist/lib/logger.mjs.map +1 -0
- package/dist/lib/unplugin/helpers.cjs +30 -0
- package/dist/lib/unplugin/helpers.cjs.map +1 -0
- package/dist/lib/unplugin/helpers.d.cts +24 -0
- package/dist/lib/unplugin/helpers.d.cts.map +1 -0
- package/dist/lib/unplugin/helpers.d.mts +24 -0
- package/dist/lib/unplugin/helpers.d.mts.map +1 -0
- package/dist/lib/unplugin/helpers.mjs +28 -0
- package/dist/lib/unplugin/helpers.mjs.map +1 -0
- package/dist/lib/unplugin/index.cjs +9 -0
- package/dist/lib/unplugin/index.d.cts +4 -0
- package/dist/lib/unplugin/index.d.mts +4 -0
- package/dist/lib/unplugin/index.mjs +5 -0
- package/dist/lib/unplugin/module-resolution.cjs +67 -0
- package/dist/lib/unplugin/module-resolution.cjs.map +1 -0
- package/dist/lib/unplugin/module-resolution.d.cts +21 -0
- package/dist/lib/unplugin/module-resolution.d.cts.map +1 -0
- package/dist/lib/unplugin/module-resolution.d.mts +21 -0
- package/dist/lib/unplugin/module-resolution.d.mts.map +1 -0
- package/dist/lib/unplugin/module-resolution.mjs +66 -0
- package/dist/lib/unplugin/module-resolution.mjs.map +1 -0
- package/dist/lib/unplugin/plugin.cjs +105 -0
- package/dist/lib/unplugin/plugin.cjs.map +1 -0
- package/dist/lib/unplugin/plugin.d.cts +22 -0
- package/dist/lib/unplugin/plugin.d.cts.map +1 -0
- package/dist/lib/unplugin/plugin.d.mts +22 -0
- package/dist/lib/unplugin/plugin.d.mts.map +1 -0
- package/dist/lib/unplugin/plugin.mjs +103 -0
- package/dist/lib/unplugin/plugin.mjs.map +1 -0
- package/dist/lib/utilities/file-header.cjs +24 -0
- package/dist/lib/utilities/file-header.cjs.map +1 -0
- package/dist/lib/utilities/file-header.d.cts +13 -0
- package/dist/lib/utilities/file-header.d.cts.map +1 -0
- package/dist/lib/utilities/file-header.d.mts +13 -0
- package/dist/lib/utilities/file-header.d.mts.map +1 -0
- package/dist/lib/utilities/file-header.mjs +22 -0
- package/dist/lib/utilities/file-header.mjs.map +1 -0
- package/dist/lib/utilities/format.cjs +49 -0
- package/dist/lib/utilities/format.cjs.map +1 -0
- package/dist/lib/utilities/format.d.cts +25 -0
- package/dist/lib/utilities/format.d.cts.map +1 -0
- package/dist/lib/utilities/format.d.mts +25 -0
- package/dist/lib/utilities/format.d.mts.map +1 -0
- package/dist/lib/utilities/format.mjs +47 -0
- package/dist/lib/utilities/format.mjs.map +1 -0
- package/dist/lib/utilities/index.cjs +15 -0
- package/dist/lib/utilities/index.d.cts +6 -0
- package/dist/lib/utilities/index.d.mts +6 -0
- package/dist/lib/utilities/index.mjs +7 -0
- package/dist/lib/utilities/source-file.cjs +50 -0
- package/dist/lib/utilities/source-file.cjs.map +1 -0
- package/dist/lib/utilities/source-file.d.cts +31 -0
- package/dist/lib/utilities/source-file.d.cts.map +1 -0
- package/dist/lib/utilities/source-file.d.mts +31 -0
- package/dist/lib/utilities/source-file.d.mts.map +1 -0
- package/dist/lib/utilities/source-file.mjs +46 -0
- package/dist/lib/utilities/source-file.mjs.map +1 -0
- package/dist/lib/utilities/source-map.cjs +57 -0
- package/dist/lib/utilities/source-map.cjs.map +1 -0
- package/dist/lib/utilities/source-map.d.cts +17 -0
- package/dist/lib/utilities/source-map.d.cts.map +1 -0
- package/dist/lib/utilities/source-map.d.mts +17 -0
- package/dist/lib/utilities/source-map.d.mts.map +1 -0
- package/dist/lib/utilities/source-map.mjs +55 -0
- package/dist/lib/utilities/source-map.mjs.map +1 -0
- package/dist/lib/utilities/write-file.cjs +29 -0
- package/dist/lib/utilities/write-file.cjs.map +1 -0
- package/dist/lib/utilities/write-file.d.cts +16 -0
- package/dist/lib/utilities/write-file.d.cts.map +1 -0
- package/dist/lib/utilities/write-file.d.mts +16 -0
- package/dist/lib/utilities/write-file.d.mts.map +1 -0
- package/dist/lib/utilities/write-file.mjs +28 -0
- package/dist/lib/utilities/write-file.mjs.map +1 -0
- package/dist/plugin-base.cjs +73 -0
- package/dist/plugin-base.cjs.map +1 -0
- package/dist/plugin-base.d.cts +27 -0
- package/dist/plugin-base.d.cts.map +1 -0
- package/dist/plugin-base.d.mts +27 -0
- package/dist/plugin-base.d.mts.map +1 -0
- package/dist/plugin-base.mjs +70 -0
- package/dist/plugin-base.mjs.map +1 -0
- package/dist/plugin-utils/build-helpers.cjs +36 -0
- package/dist/plugin-utils/build-helpers.cjs.map +1 -0
- package/dist/plugin-utils/build-helpers.d.cts +19 -0
- package/dist/plugin-utils/build-helpers.d.cts.map +1 -0
- package/dist/plugin-utils/build-helpers.d.mts +19 -0
- package/dist/plugin-utils/build-helpers.d.mts.map +1 -0
- package/dist/plugin-utils/build-helpers.mjs +35 -0
- package/dist/plugin-utils/build-helpers.mjs.map +1 -0
- package/dist/plugin-utils/context-helpers.cjs +50 -0
- package/dist/plugin-utils/context-helpers.cjs.map +1 -0
- package/dist/plugin-utils/context-helpers.d.cts +21 -0
- package/dist/plugin-utils/context-helpers.d.cts.map +1 -0
- package/dist/plugin-utils/context-helpers.d.mts +21 -0
- package/dist/plugin-utils/context-helpers.d.mts.map +1 -0
- package/dist/plugin-utils/context-helpers.mjs +48 -0
- package/dist/plugin-utils/context-helpers.mjs.map +1 -0
- package/dist/plugin-utils/extend.cjs +25 -0
- package/dist/plugin-utils/extend.cjs.map +1 -0
- package/dist/plugin-utils/extend.d.cts +20 -0
- package/dist/plugin-utils/extend.d.cts.map +1 -0
- package/dist/plugin-utils/extend.d.mts +20 -0
- package/dist/plugin-utils/extend.d.mts.map +1 -0
- package/dist/plugin-utils/extend.mjs +24 -0
- package/dist/plugin-utils/extend.mjs.map +1 -0
- package/dist/plugin-utils/format-package-json.cjs +20 -0
- package/dist/plugin-utils/format-package-json.cjs.map +1 -0
- package/dist/plugin-utils/format-package-json.d.cts +13 -0
- package/dist/plugin-utils/format-package-json.d.cts.map +1 -0
- package/dist/plugin-utils/format-package-json.d.mts +13 -0
- package/dist/plugin-utils/format-package-json.d.mts.map +1 -0
- package/dist/plugin-utils/format-package-json.mjs +19 -0
- package/dist/plugin-utils/format-package-json.mjs.map +1 -0
- package/dist/plugin-utils/get-config-path.cjs +50 -0
- package/dist/plugin-utils/get-config-path.cjs.map +1 -0
- package/dist/plugin-utils/get-config-path.d.cts +15 -0
- package/dist/plugin-utils/get-config-path.d.cts.map +1 -0
- package/dist/plugin-utils/get-config-path.d.mts +15 -0
- package/dist/plugin-utils/get-config-path.d.mts.map +1 -0
- package/dist/plugin-utils/get-config-path.mjs +49 -0
- package/dist/plugin-utils/get-config-path.mjs.map +1 -0
- package/dist/plugin-utils/helpers.cjs +185 -0
- package/dist/plugin-utils/helpers.cjs.map +1 -0
- package/dist/plugin-utils/helpers.d.cts +144 -0
- package/dist/plugin-utils/helpers.d.cts.map +1 -0
- package/dist/plugin-utils/helpers.d.mts +144 -0
- package/dist/plugin-utils/helpers.d.mts.map +1 -0
- package/dist/plugin-utils/helpers.mjs +170 -0
- package/dist/plugin-utils/helpers.mjs.map +1 -0
- package/dist/plugin-utils/index.cjs +35 -0
- package/dist/plugin-utils/index.d.cts +10 -0
- package/dist/plugin-utils/index.d.mts +10 -0
- package/dist/plugin-utils/index.mjs +11 -0
- package/dist/plugin-utils/merge.cjs +60 -0
- package/dist/plugin-utils/merge.cjs.map +1 -0
- package/dist/plugin-utils/merge.d.cts +35 -0
- package/dist/plugin-utils/merge.d.cts.map +1 -0
- package/dist/plugin-utils/merge.d.mts +35 -0
- package/dist/plugin-utils/merge.d.mts.map +1 -0
- package/dist/plugin-utils/merge.mjs +57 -0
- package/dist/plugin-utils/merge.mjs.map +1 -0
- package/dist/plugin-utils/modules.cjs +17 -0
- package/dist/plugin-utils/modules.cjs.map +1 -0
- package/dist/plugin-utils/modules.d.cts +15 -0
- package/dist/plugin-utils/modules.d.cts.map +1 -0
- package/dist/plugin-utils/modules.d.mts +15 -0
- package/dist/plugin-utils/modules.d.mts.map +1 -0
- package/dist/plugin-utils/modules.mjs +16 -0
- package/dist/plugin-utils/modules.mjs.map +1 -0
- package/dist/plugin-utils/paths.cjs +38 -0
- package/dist/plugin-utils/paths.cjs.map +1 -0
- package/dist/plugin-utils/paths.d.cts +34 -0
- package/dist/plugin-utils/paths.d.cts.map +1 -0
- package/dist/plugin-utils/paths.d.mts +34 -0
- package/dist/plugin-utils/paths.d.mts.map +1 -0
- package/dist/plugin-utils/paths.mjs +37 -0
- package/dist/plugin-utils/paths.mjs.map +1 -0
- package/dist/types/_internal.cjs +0 -0
- package/dist/types/_internal.d.cts +107 -0
- package/dist/types/_internal.d.cts.map +1 -0
- package/dist/types/_internal.d.mts +107 -0
- package/dist/types/_internal.d.mts.map +1 -0
- package/dist/types/_internal.mjs +1 -0
- package/dist/types/api.cjs +0 -0
- package/dist/types/api.d.cts +104 -0
- package/dist/types/api.d.cts.map +1 -0
- package/dist/types/api.d.mts +104 -0
- package/dist/types/api.d.mts.map +1 -0
- package/dist/types/api.mjs +1 -0
- package/dist/types/commands.cjs +17 -0
- package/dist/types/commands.cjs.map +1 -0
- package/dist/types/commands.d.cts +13 -0
- package/dist/types/commands.d.cts.map +1 -0
- package/dist/types/commands.d.mts +13 -0
- package/dist/types/commands.d.mts.map +1 -0
- package/dist/types/commands.mjs +16 -0
- package/dist/types/commands.mjs.map +1 -0
- package/dist/types/config.cjs +0 -0
- package/dist/types/config.d.cts +617 -0
- package/dist/types/config.d.cts.map +1 -0
- package/dist/types/config.d.mts +617 -0
- package/dist/types/config.d.mts.map +1 -0
- package/dist/types/config.mjs +1 -0
- package/dist/types/context.cjs +0 -0
- package/dist/types/context.d.cts +564 -0
- package/dist/types/context.d.cts.map +1 -0
- package/dist/types/context.d.mts +564 -0
- package/dist/types/context.d.mts.map +1 -0
- package/dist/types/context.mjs +1 -0
- package/dist/types/fs.cjs +11 -0
- package/dist/types/fs.cjs.map +1 -0
- package/dist/types/fs.d.cts +502 -0
- package/dist/types/fs.d.cts.map +1 -0
- package/dist/types/fs.d.mts +502 -0
- package/dist/types/fs.d.mts.map +1 -0
- package/dist/types/fs.mjs +8 -0
- package/dist/types/fs.mjs.map +1 -0
- package/dist/types/hooks.cjs +13 -0
- package/dist/types/hooks.cjs.map +1 -0
- package/dist/types/hooks.d.cts +117 -0
- package/dist/types/hooks.d.cts.map +1 -0
- package/dist/types/hooks.d.mts +117 -0
- package/dist/types/hooks.d.mts.map +1 -0
- package/dist/types/hooks.mjs +12 -0
- package/dist/types/hooks.mjs.map +1 -0
- package/dist/types/index.cjs +16 -0
- package/dist/types/index.d.cts +10 -0
- package/dist/types/index.d.mts +10 -0
- package/dist/types/index.mjs +7 -0
- package/dist/types/plugin.cjs +35 -0
- package/dist/types/plugin.cjs.map +1 -0
- package/dist/types/plugin.d.cts +218 -0
- package/dist/types/plugin.d.cts.map +1 -0
- package/dist/types/plugin.d.mts +218 -0
- package/dist/types/plugin.d.mts.map +1 -0
- package/dist/types/plugin.mjs +33 -0
- package/dist/types/plugin.mjs.map +1 -0
- package/dist/types/tsconfig.cjs +0 -0
- package/dist/types/tsconfig.d.cts +77 -0
- package/dist/types/tsconfig.d.cts.map +1 -0
- package/dist/types/tsconfig.d.mts +77 -0
- package/dist/types/tsconfig.d.mts.map +1 -0
- package/dist/types/tsconfig.mjs +1 -0
- package/dist/types/unplugin.cjs +24 -0
- package/dist/types/unplugin.cjs.map +1 -0
- package/dist/types/unplugin.d.cts +41 -0
- package/dist/types/unplugin.d.cts.map +1 -0
- package/dist/types/unplugin.d.mts +41 -0
- package/dist/types/unplugin.d.mts.map +1 -0
- package/dist/types/unplugin.mjs +22 -0
- package/dist/types/unplugin.mjs.map +1 -0
- package/package.json +238 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/lib/unplugin/module-resolution.ts
|
|
3
|
+
/**
|
|
4
|
+
* Creates the module resolution hook functions for a Powerlines unplugin plugin instance.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This includes the `resolveId` and `load` hooks.
|
|
8
|
+
*
|
|
9
|
+
* @see https://rollupjs.org/plugin-development/#resolveid
|
|
10
|
+
* @see https://rollupjs.org/plugin-development/#load
|
|
11
|
+
*
|
|
12
|
+
* @param context - The plugin context.
|
|
13
|
+
* @returns The module resolution hooks (`resolveId` and `load`).
|
|
14
|
+
*/
|
|
15
|
+
function createUnpluginModuleResolutionFunctions(context) {
|
|
16
|
+
const ctx = context;
|
|
17
|
+
async function resolveId(id, importer, opts = { isEntry: false }) {
|
|
18
|
+
let result = await ctx.$$internal.callHook("resolveId", {
|
|
19
|
+
sequential: true,
|
|
20
|
+
result: "first",
|
|
21
|
+
order: "pre"
|
|
22
|
+
}, id, importer, opts);
|
|
23
|
+
if (result) return result;
|
|
24
|
+
result = await ctx.$$internal.callHook("resolveId", {
|
|
25
|
+
sequential: true,
|
|
26
|
+
result: "first",
|
|
27
|
+
order: "normal"
|
|
28
|
+
}, id, importer, opts);
|
|
29
|
+
if (result) return result;
|
|
30
|
+
result = await ctx.resolve(id, importer, opts);
|
|
31
|
+
if (result) return result;
|
|
32
|
+
return ctx.$$internal.callHook("resolveId", {
|
|
33
|
+
sequential: true,
|
|
34
|
+
result: "first",
|
|
35
|
+
order: "post"
|
|
36
|
+
}, id, importer, opts);
|
|
37
|
+
}
|
|
38
|
+
async function load(id) {
|
|
39
|
+
let result = await ctx.$$internal.callHook("load", {
|
|
40
|
+
sequential: true,
|
|
41
|
+
result: "first",
|
|
42
|
+
order: "pre"
|
|
43
|
+
}, id);
|
|
44
|
+
if (result) return result;
|
|
45
|
+
result = await ctx.$$internal.callHook("load", {
|
|
46
|
+
sequential: true,
|
|
47
|
+
result: "first",
|
|
48
|
+
order: "normal"
|
|
49
|
+
}, id);
|
|
50
|
+
if (result) return result;
|
|
51
|
+
result = await ctx.load(id);
|
|
52
|
+
if (result) return result;
|
|
53
|
+
return ctx.$$internal.callHook("load", {
|
|
54
|
+
sequential: true,
|
|
55
|
+
result: "first",
|
|
56
|
+
order: "post"
|
|
57
|
+
}, id);
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
resolveId,
|
|
61
|
+
load
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
exports.createUnpluginModuleResolutionFunctions = createUnpluginModuleResolutionFunctions;
|
|
67
|
+
//# sourceMappingURL=module-resolution.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-resolution.cjs","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 { 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\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>(context: TContext): Pick<HookFnMap, \"resolveId\" | \"load\"> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n\n async function 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 (result) {\n return result;\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 (result) {\n return result;\n }\n\n result = await ctx.resolve(id, importer, opts);\n if (result) {\n return result;\n }\n\n return ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n id,\n importer,\n opts\n );\n }\n\n async function load(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<LoadResult | null | undefined> {\n let result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n id\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 id\n );\n if (result) {\n return result;\n }\n\n result = await ctx.load(id);\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 id\n );\n }\n\n return {\n resolveId,\n load\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAwCA,SAAgB,wCAEd,SAA0D;CAC1D,MAAM,MAAM;CAEZ,eAAe,UAEb,IACA,UACA,OAEI,EAAE,SAAS,OAAO,EACiC;EACvD,IAAI,SAAS,MAAM,IAAI,WAAW,SAChC,aACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,IACA,UACA,KACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,WAAW,SAC5B,aACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,IACA,UACA,KACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,QAAQ,IAAI,UAAU,KAAK;AAC9C,MAAI,OACF,QAAO;AAGT,SAAO,IAAI,WAAW,SACpB,aACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,IACA,UACA,KACD;;CAGH,eAAe,KAEb,IACwC;EACxC,IAAI,SAAS,MAAM,IAAI,WAAW,SAChC,QACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,GACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,WAAW,SAC5B,QACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,GACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,KAAK,GAAG;AAC3B,MAAI,OACF,QAAO;AAGT,SAAO,IAAI,WAAW,SACpB,QACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,GACD;;AAGH,QAAO;EACL;EACA;EACD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PluginContext } from "../../types/context.cjs";
|
|
2
|
+
import { HookFnMap } from "unplugin";
|
|
3
|
+
|
|
4
|
+
//#region src/lib/unplugin/module-resolution.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates the module resolution hook functions for a Powerlines unplugin plugin instance.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This includes the `resolveId` and `load` hooks.
|
|
11
|
+
*
|
|
12
|
+
* @see https://rollupjs.org/plugin-development/#resolveid
|
|
13
|
+
* @see https://rollupjs.org/plugin-development/#load
|
|
14
|
+
*
|
|
15
|
+
* @param context - The plugin context.
|
|
16
|
+
* @returns The module resolution hooks (`resolveId` and `load`).
|
|
17
|
+
*/
|
|
18
|
+
declare function createUnpluginModuleResolutionFunctions<TContext extends PluginContext = PluginContext>(context: TContext): Pick<HookFnMap, "resolveId" | "load">;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { createUnpluginModuleResolutionFunctions };
|
|
21
|
+
//# sourceMappingURL=module-resolution.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-resolution.d.cts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"sourcesContent":[],"mappings":";;;;;;;AAwCA;;;;;;;;;;iBAAgB,yDACG,gBAAgB,wBACxB,WAAW,KAAK"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PluginContext } from "../../types/context.mjs";
|
|
2
|
+
import { HookFnMap } from "unplugin";
|
|
3
|
+
|
|
4
|
+
//#region src/lib/unplugin/module-resolution.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates the module resolution hook functions for a Powerlines unplugin plugin instance.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This includes the `resolveId` and `load` hooks.
|
|
11
|
+
*
|
|
12
|
+
* @see https://rollupjs.org/plugin-development/#resolveid
|
|
13
|
+
* @see https://rollupjs.org/plugin-development/#load
|
|
14
|
+
*
|
|
15
|
+
* @param context - The plugin context.
|
|
16
|
+
* @returns The module resolution hooks (`resolveId` and `load`).
|
|
17
|
+
*/
|
|
18
|
+
declare function createUnpluginModuleResolutionFunctions<TContext extends PluginContext = PluginContext>(context: TContext): Pick<HookFnMap, "resolveId" | "load">;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { createUnpluginModuleResolutionFunctions };
|
|
21
|
+
//# sourceMappingURL=module-resolution.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-resolution.d.mts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"sourcesContent":[],"mappings":";;;;;;;AAwCA;;;;;;;;;;iBAAgB,yDACG,gBAAgB,wBACxB,WAAW,KAAK"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//#region src/lib/unplugin/module-resolution.ts
|
|
2
|
+
/**
|
|
3
|
+
* Creates the module resolution hook functions for a Powerlines unplugin plugin instance.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This includes the `resolveId` and `load` hooks.
|
|
7
|
+
*
|
|
8
|
+
* @see https://rollupjs.org/plugin-development/#resolveid
|
|
9
|
+
* @see https://rollupjs.org/plugin-development/#load
|
|
10
|
+
*
|
|
11
|
+
* @param context - The plugin context.
|
|
12
|
+
* @returns The module resolution hooks (`resolveId` and `load`).
|
|
13
|
+
*/
|
|
14
|
+
function createUnpluginModuleResolutionFunctions(context) {
|
|
15
|
+
const ctx = context;
|
|
16
|
+
async function resolveId(id, importer, opts = { isEntry: false }) {
|
|
17
|
+
let result = await ctx.$$internal.callHook("resolveId", {
|
|
18
|
+
sequential: true,
|
|
19
|
+
result: "first",
|
|
20
|
+
order: "pre"
|
|
21
|
+
}, id, importer, opts);
|
|
22
|
+
if (result) return result;
|
|
23
|
+
result = await ctx.$$internal.callHook("resolveId", {
|
|
24
|
+
sequential: true,
|
|
25
|
+
result: "first",
|
|
26
|
+
order: "normal"
|
|
27
|
+
}, id, importer, opts);
|
|
28
|
+
if (result) return result;
|
|
29
|
+
result = await ctx.resolve(id, importer, opts);
|
|
30
|
+
if (result) return result;
|
|
31
|
+
return ctx.$$internal.callHook("resolveId", {
|
|
32
|
+
sequential: true,
|
|
33
|
+
result: "first",
|
|
34
|
+
order: "post"
|
|
35
|
+
}, id, importer, opts);
|
|
36
|
+
}
|
|
37
|
+
async function load(id) {
|
|
38
|
+
let result = await ctx.$$internal.callHook("load", {
|
|
39
|
+
sequential: true,
|
|
40
|
+
result: "first",
|
|
41
|
+
order: "pre"
|
|
42
|
+
}, id);
|
|
43
|
+
if (result) return result;
|
|
44
|
+
result = await ctx.$$internal.callHook("load", {
|
|
45
|
+
sequential: true,
|
|
46
|
+
result: "first",
|
|
47
|
+
order: "normal"
|
|
48
|
+
}, id);
|
|
49
|
+
if (result) return result;
|
|
50
|
+
result = await ctx.load(id);
|
|
51
|
+
if (result) return result;
|
|
52
|
+
return ctx.$$internal.callHook("load", {
|
|
53
|
+
sequential: true,
|
|
54
|
+
result: "first",
|
|
55
|
+
order: "post"
|
|
56
|
+
}, id);
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
resolveId,
|
|
60
|
+
load
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { createUnpluginModuleResolutionFunctions };
|
|
66
|
+
//# sourceMappingURL=module-resolution.mjs.map
|
|
@@ -0,0 +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 { 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\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>(context: TContext): Pick<HookFnMap, \"resolveId\" | \"load\"> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n\n async function 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 (result) {\n return result;\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 (result) {\n return result;\n }\n\n result = await ctx.resolve(id, importer, opts);\n if (result) {\n return result;\n }\n\n return ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n id,\n importer,\n opts\n );\n }\n\n async function load(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<LoadResult | null | undefined> {\n let result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n id\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 id\n );\n if (result) {\n return result;\n }\n\n result = await ctx.load(id);\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 id\n );\n }\n\n return {\n resolveId,\n load\n };\n}\n"],"mappings":";;;;;;;;;;;;;AAwCA,SAAgB,wCAEd,SAA0D;CAC1D,MAAM,MAAM;CAEZ,eAAe,UAEb,IACA,UACA,OAEI,EAAE,SAAS,OAAO,EACiC;EACvD,IAAI,SAAS,MAAM,IAAI,WAAW,SAChC,aACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,IACA,UACA,KACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,WAAW,SAC5B,aACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,IACA,UACA,KACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,QAAQ,IAAI,UAAU,KAAK;AAC9C,MAAI,OACF,QAAO;AAGT,SAAO,IAAI,WAAW,SACpB,aACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,IACA,UACA,KACD;;CAGH,eAAe,KAEb,IACwC;EACxC,IAAI,SAAS,MAAM,IAAI,WAAW,SAChC,QACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,GACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,WAAW,SAC5B,QACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,GACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,KAAK,GAAG;AAC3B,MAAI,OACF,QAAO;AAGT,SAAO,IAAI,WAAW,SACpB,QACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,GACD;;AAGH,QAAO;EACL;EACA;EACD"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_lib_logger = require('../logger.cjs');
|
|
3
|
+
const require_lib_unplugin_helpers = require('./helpers.cjs');
|
|
4
|
+
const require_lib_unplugin_module_resolution = require('./module-resolution.cjs');
|
|
5
|
+
const require_lib_utilities_source_file = require('../utilities/source-file.cjs');
|
|
6
|
+
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
7
|
+
let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
8
|
+
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
9
|
+
let unplugin = require("unplugin");
|
|
10
|
+
|
|
11
|
+
//#region src/lib/unplugin/plugin.ts
|
|
12
|
+
/**
|
|
13
|
+
* Creates a Powerlines unplugin instance.
|
|
14
|
+
*
|
|
15
|
+
* @param context - The plugin context.
|
|
16
|
+
* @returns The unplugin instance.
|
|
17
|
+
*/
|
|
18
|
+
function createUnpluginResolver(context, name = "unplugin") {
|
|
19
|
+
const ctx = context;
|
|
20
|
+
(0, unplugin.setParseImpl)(ctx.parse);
|
|
21
|
+
return () => {
|
|
22
|
+
const log = require_lib_logger.extendLog(ctx.log, name);
|
|
23
|
+
log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, `Initializing ${name.toLowerCase() === "unplugin" ? "Unplugin" : `${(0, __stryke_string_format_title_case.titleCase)(name)} - Unplugin`} plugin`);
|
|
24
|
+
try {
|
|
25
|
+
const { resolveId, load } = require_lib_unplugin_module_resolution.createUnpluginModuleResolutionFunctions(context);
|
|
26
|
+
return {
|
|
27
|
+
name: name.toLowerCase() === "unplugin" ? "powerlines" : `powerlines:${(0, __stryke_string_format_kebab_case.kebabCase)(name)}`,
|
|
28
|
+
api: ctx.$$internal.api,
|
|
29
|
+
resolveId: {
|
|
30
|
+
filter: { id: { include: [/.*/] } },
|
|
31
|
+
handler: resolveId
|
|
32
|
+
},
|
|
33
|
+
load: {
|
|
34
|
+
filter: { id: { include: [/.*/] } },
|
|
35
|
+
handler: load
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
} catch (error) {
|
|
39
|
+
log(__storm_software_config_tools_types.LogLevelLabel.FATAL, error?.message);
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Creates a Powerlines unplugin instance.
|
|
46
|
+
*
|
|
47
|
+
* @param context - The plugin context.
|
|
48
|
+
* @returns The unplugin instance.
|
|
49
|
+
*/
|
|
50
|
+
function createUnplugin(context, name = "unplugin") {
|
|
51
|
+
const ctx = context;
|
|
52
|
+
(0, unplugin.setParseImpl)(ctx.parse);
|
|
53
|
+
return () => {
|
|
54
|
+
const log = require_lib_logger.extendLog(ctx.log, name);
|
|
55
|
+
log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, `Initializing ${name.toLowerCase() === "unplugin" ? "Unplugin" : `${(0, __stryke_string_format_title_case.titleCase)(name)} - Unplugin`} plugin`);
|
|
56
|
+
try {
|
|
57
|
+
const { resolveId, load } = require_lib_unplugin_module_resolution.createUnpluginModuleResolutionFunctions(context);
|
|
58
|
+
async function buildStart() {
|
|
59
|
+
log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, "Powerlines build plugin starting...");
|
|
60
|
+
await ctx.$$internal.callHook("buildStart", { sequential: true });
|
|
61
|
+
}
|
|
62
|
+
async function transform(code, id) {
|
|
63
|
+
let transformed = code;
|
|
64
|
+
for (const hook of ctx.$$internal.environment.selectHooks("transform")) {
|
|
65
|
+
const result = await hook.handler.apply(require_lib_unplugin_helpers.combineContexts(ctx, this), [require_lib_utilities_source_file.getString(transformed), id]);
|
|
66
|
+
if (result) transformed = result;
|
|
67
|
+
}
|
|
68
|
+
return transformed;
|
|
69
|
+
}
|
|
70
|
+
async function buildEnd() {
|
|
71
|
+
log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, "Powerlines build plugin finishing...");
|
|
72
|
+
return ctx.$$internal.callHook("buildEnd", { sequential: true });
|
|
73
|
+
}
|
|
74
|
+
async function writeBundle() {
|
|
75
|
+
log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, "Finalizing Powerlines project output...");
|
|
76
|
+
return ctx.$$internal.callHook("writeBundle", { sequential: true });
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
name: name.toLowerCase() === "unplugin" ? "powerlines" : `powerlines:${(0, __stryke_string_format_kebab_case.kebabCase)(name)}`,
|
|
80
|
+
api: ctx.$$internal.api,
|
|
81
|
+
resolveId: {
|
|
82
|
+
filter: { id: { include: [/.*/] } },
|
|
83
|
+
handler: resolveId
|
|
84
|
+
},
|
|
85
|
+
load: {
|
|
86
|
+
filter: { id: { include: [/.*/] } },
|
|
87
|
+
handler: load
|
|
88
|
+
},
|
|
89
|
+
transform,
|
|
90
|
+
buildStart,
|
|
91
|
+
buildEnd,
|
|
92
|
+
writeBundle,
|
|
93
|
+
vite: { sharedDuringBuild: true }
|
|
94
|
+
};
|
|
95
|
+
} catch (error) {
|
|
96
|
+
log(__storm_software_config_tools_types.LogLevelLabel.FATAL, error?.message);
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
//#endregion
|
|
103
|
+
exports.createUnplugin = createUnplugin;
|
|
104
|
+
exports.createUnpluginResolver = createUnpluginResolver;
|
|
105
|
+
//# sourceMappingURL=plugin.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs","names":["extendLog","LogLevelLabel","createUnpluginModuleResolutionFunctions","transformed: TransformResult | string","result: TransformResult | string | undefined","combineContexts","getString"],"sources":["../../../src/lib/unplugin/plugin.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 { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport type {\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { setParseImpl } from \"unplugin\";\nimport { UNSAFE_PluginContext } from \"../../types/_internal\";\nimport { PluginContext } from \"../../types/context\";\nimport { UnpluginFactory } from \"../../types/unplugin\";\nimport { extendLog } from \"../logger\";\nimport { getString } from \"../utilities/source-file\";\nimport { combineContexts } from \"./helpers\";\nimport { createUnpluginModuleResolutionFunctions } from \"./module-resolution\";\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnpluginResolver<\n TContext extends PluginContext = PluginContext\n>(context: TContext, name = \"unplugin\"): UnpluginFactory<TContext> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n setParseImpl(ctx.parse);\n\n return () => {\n const log = extendLog(ctx.log, name);\n log(\n LogLevelLabel.DEBUG,\n `Initializing ${\n name.toLowerCase() === \"unplugin\"\n ? \"Unplugin\"\n : `${titleCase(name)} - Unplugin`\n } plugin`\n );\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context);\n\n return {\n name:\n name.toLowerCase() === \"unplugin\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.$$internal.api,\n resolveId: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: resolveId\n },\n load: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: load\n }\n };\n } catch (error) {\n log(LogLevelLabel.FATAL, (error as Error)?.message);\n\n throw error;\n }\n };\n}\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnplugin<TContext extends PluginContext = PluginContext>(\n context: TContext,\n name = \"unplugin\"\n): UnpluginFactory<TContext> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n setParseImpl(ctx.parse);\n\n return () => {\n const log = extendLog(ctx.log, name);\n log(\n LogLevelLabel.DEBUG,\n `Initializing ${\n name.toLowerCase() === \"unplugin\"\n ? \"Unplugin\"\n : `${titleCase(name)} - Unplugin`\n } plugin`\n );\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context);\n\n async function buildStart(this: UnpluginBuildContext) {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin starting...\");\n\n await ctx.$$internal.callHook(\"buildStart\", {\n sequential: true\n });\n }\n\n async function transform(\n this: UnpluginBuildContext & UnpluginContext,\n code: string,\n id: string\n ): Promise<TransformResult | null | undefined> {\n let transformed: TransformResult | string = code;\n\n for (const hook of ctx.$$internal.environment.selectHooks(\n \"transform\"\n )) {\n const result: TransformResult | string | undefined =\n await hook.handler.apply(combineContexts(ctx, this), [\n getString(transformed),\n id\n ]);\n if (result) {\n transformed = result;\n }\n }\n\n return transformed;\n }\n\n async function buildEnd(this: UnpluginBuildContext): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin finishing...\");\n\n return ctx.$$internal.callHook(\"buildEnd\", {\n sequential: true\n });\n }\n\n async function writeBundle(): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Finalizing Powerlines project output...\");\n\n return ctx.$$internal.callHook(\"writeBundle\", {\n sequential: true\n });\n }\n\n return {\n name:\n name.toLowerCase() === \"unplugin\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.$$internal.api,\n resolveId: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: resolveId\n },\n load: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: load\n },\n transform,\n buildStart,\n buildEnd,\n writeBundle,\n vite: {\n sharedDuringBuild: true\n }\n };\n } catch (error) {\n log(LogLevelLabel.FATAL, (error as Error)?.message);\n\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAyCA,SAAgB,uBAEd,SAAmB,OAAO,YAAuC;CACjE,MAAM,MAAM;AACZ,4BAAa,IAAI,MAAM;AAEvB,cAAa;EACX,MAAM,MAAMA,6BAAU,IAAI,KAAK,KAAK;AACpC,MACEC,kDAAc,OACd,gBACE,KAAK,aAAa,KAAK,aACnB,aACA,oDAAa,KAAK,CAAC,aACxB,SACF;AAED,MAAI;GACF,MAAM,EAAE,WAAW,SACjBC,+EAAkD,QAAQ;AAE5D,UAAO;IACL,MACE,KAAK,aAAa,KAAK,aACnB,eACA,+DAAwB,KAAK;IACnC,KAAK,IAAI,WAAW;IACpB,WAAW;KACT,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACD,MAAM;KACJ,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACF;WACM,OAAO;AACd,OAAID,kDAAc,OAAQ,OAAiB,QAAQ;AAEnD,SAAM;;;;;;;;;;AAWZ,SAAgB,eACd,SACA,OAAO,YACoB;CAC3B,MAAM,MAAM;AACZ,4BAAa,IAAI,MAAM;AAEvB,cAAa;EACX,MAAM,MAAMD,6BAAU,IAAI,KAAK,KAAK;AACpC,MACEC,kDAAc,OACd,gBACE,KAAK,aAAa,KAAK,aACnB,aACA,oDAAa,KAAK,CAAC,aACxB,SACF;AAED,MAAI;GACF,MAAM,EAAE,WAAW,SACjBC,+EAAkD,QAAQ;GAE5D,eAAe,aAAuC;AACpD,QAAID,kDAAc,OAAO,sCAAsC;AAE/D,UAAM,IAAI,WAAW,SAAS,cAAc,EAC1C,YAAY,MACb,CAAC;;GAGJ,eAAe,UAEb,MACA,IAC6C;IAC7C,IAAIE,cAAwC;AAE5C,SAAK,MAAM,QAAQ,IAAI,WAAW,YAAY,YAC5C,YACD,EAAE;KACD,MAAMC,SACJ,MAAM,KAAK,QAAQ,MAAMC,6CAAgB,KAAK,KAAK,EAAE,CACnDC,4CAAU,YAAY,EACtB,GACD,CAAC;AACJ,SAAI,OACF,eAAc;;AAIlB,WAAO;;GAGT,eAAe,WAAoD;AACjE,QAAIL,kDAAc,OAAO,uCAAuC;AAEhE,WAAO,IAAI,WAAW,SAAS,YAAY,EACzC,YAAY,MACb,CAAC;;GAGJ,eAAe,cAA6B;AAC1C,QAAIA,kDAAc,OAAO,0CAA0C;AAEnE,WAAO,IAAI,WAAW,SAAS,eAAe,EAC5C,YAAY,MACb,CAAC;;AAGJ,UAAO;IACL,MACE,KAAK,aAAa,KAAK,aACnB,eACA,+DAAwB,KAAK;IACnC,KAAK,IAAI,WAAW;IACpB,WAAW;KACT,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACD,MAAM;KACJ,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACD;IACA;IACA;IACA;IACA,MAAM,EACJ,mBAAmB,MACpB;IACF;WACM,OAAO;AACd,OAAIA,kDAAc,OAAQ,OAAiB,QAAQ;AAEnD,SAAM"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { UnpluginFactory } from "../../types/unplugin.cjs";
|
|
2
|
+
import { PluginContext } from "../../types/context.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/lib/unplugin/plugin.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a Powerlines unplugin instance.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The plugin context.
|
|
10
|
+
* @returns The unplugin instance.
|
|
11
|
+
*/
|
|
12
|
+
declare function createUnpluginResolver<TContext extends PluginContext = PluginContext>(context: TContext, name?: string): UnpluginFactory<TContext>;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a Powerlines unplugin instance.
|
|
15
|
+
*
|
|
16
|
+
* @param context - The plugin context.
|
|
17
|
+
* @returns The unplugin instance.
|
|
18
|
+
*/
|
|
19
|
+
declare function createUnplugin<TContext extends PluginContext = PluginContext>(context: TContext, name?: string): UnpluginFactory<TContext>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { createUnplugin, createUnpluginResolver };
|
|
22
|
+
//# sourceMappingURL=plugin.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../../src/lib/unplugin/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;AAyCA;;;;AAEyD,iBAFzC,sBAEyC,CAAA,iBADtC,aACsC,GADtB,aACsB,CAAA,CAAA,OAAA,EAA9C,QAA8C,EAAA,IAAA,CAAA,EAAA,MAAA,CAAA,EAAhB,eAAgB,CAAA,QAAA,CAAA;;;AAwDzD;;;;AAGmB,iBAHH,cAGG,CAAA,iBAH6B,aAG7B,GAH6C,aAG7C,CAAA,CAAA,OAAA,EAFR,QAEQ,EAAA,IAAA,CAAA,EAAA,MAAA,CAAA,EAAhB,eAAgB,CAAA,QAAA,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { UnpluginFactory } from "../../types/unplugin.mjs";
|
|
2
|
+
import { PluginContext } from "../../types/context.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/lib/unplugin/plugin.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a Powerlines unplugin instance.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The plugin context.
|
|
10
|
+
* @returns The unplugin instance.
|
|
11
|
+
*/
|
|
12
|
+
declare function createUnpluginResolver<TContext extends PluginContext = PluginContext>(context: TContext, name?: string): UnpluginFactory<TContext>;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a Powerlines unplugin instance.
|
|
15
|
+
*
|
|
16
|
+
* @param context - The plugin context.
|
|
17
|
+
* @returns The unplugin instance.
|
|
18
|
+
*/
|
|
19
|
+
declare function createUnplugin<TContext extends PluginContext = PluginContext>(context: TContext, name?: string): UnpluginFactory<TContext>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { createUnplugin, createUnpluginResolver };
|
|
22
|
+
//# sourceMappingURL=plugin.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../../src/lib/unplugin/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;AAyCA;;;;AAEyD,iBAFzC,sBAEyC,CAAA,iBADtC,aACsC,GADtB,aACsB,CAAA,CAAA,OAAA,EAA9C,QAA8C,EAAA,IAAA,CAAA,EAAA,MAAA,CAAA,EAAhB,eAAgB,CAAA,QAAA,CAAA;;;AAwDzD;;;;AAGmB,iBAHH,cAGG,CAAA,iBAH6B,aAG7B,GAH6C,aAG7C,CAAA,CAAA,OAAA,EAFR,QAEQ,EAAA,IAAA,CAAA,EAAA,MAAA,CAAA,EAAhB,eAAgB,CAAA,QAAA,CAAA"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { extendLog } from "../logger.mjs";
|
|
2
|
+
import { combineContexts } from "./helpers.mjs";
|
|
3
|
+
import { createUnpluginModuleResolutionFunctions } from "./module-resolution.mjs";
|
|
4
|
+
import { getString } from "../utilities/source-file.mjs";
|
|
5
|
+
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
6
|
+
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
7
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
8
|
+
import { setParseImpl } from "unplugin";
|
|
9
|
+
|
|
10
|
+
//#region src/lib/unplugin/plugin.ts
|
|
11
|
+
/**
|
|
12
|
+
* Creates a Powerlines unplugin instance.
|
|
13
|
+
*
|
|
14
|
+
* @param context - The plugin context.
|
|
15
|
+
* @returns The unplugin instance.
|
|
16
|
+
*/
|
|
17
|
+
function createUnpluginResolver(context, name = "unplugin") {
|
|
18
|
+
const ctx = context;
|
|
19
|
+
setParseImpl(ctx.parse);
|
|
20
|
+
return () => {
|
|
21
|
+
const log = extendLog(ctx.log, name);
|
|
22
|
+
log(LogLevelLabel.DEBUG, `Initializing ${name.toLowerCase() === "unplugin" ? "Unplugin" : `${titleCase(name)} - Unplugin`} plugin`);
|
|
23
|
+
try {
|
|
24
|
+
const { resolveId, load } = createUnpluginModuleResolutionFunctions(context);
|
|
25
|
+
return {
|
|
26
|
+
name: name.toLowerCase() === "unplugin" ? "powerlines" : `powerlines:${kebabCase(name)}`,
|
|
27
|
+
api: ctx.$$internal.api,
|
|
28
|
+
resolveId: {
|
|
29
|
+
filter: { id: { include: [/.*/] } },
|
|
30
|
+
handler: resolveId
|
|
31
|
+
},
|
|
32
|
+
load: {
|
|
33
|
+
filter: { id: { include: [/.*/] } },
|
|
34
|
+
handler: load
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
} catch (error) {
|
|
38
|
+
log(LogLevelLabel.FATAL, error?.message);
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Creates a Powerlines unplugin instance.
|
|
45
|
+
*
|
|
46
|
+
* @param context - The plugin context.
|
|
47
|
+
* @returns The unplugin instance.
|
|
48
|
+
*/
|
|
49
|
+
function createUnplugin(context, name = "unplugin") {
|
|
50
|
+
const ctx = context;
|
|
51
|
+
setParseImpl(ctx.parse);
|
|
52
|
+
return () => {
|
|
53
|
+
const log = extendLog(ctx.log, name);
|
|
54
|
+
log(LogLevelLabel.DEBUG, `Initializing ${name.toLowerCase() === "unplugin" ? "Unplugin" : `${titleCase(name)} - Unplugin`} plugin`);
|
|
55
|
+
try {
|
|
56
|
+
const { resolveId, load } = createUnpluginModuleResolutionFunctions(context);
|
|
57
|
+
async function buildStart() {
|
|
58
|
+
log(LogLevelLabel.DEBUG, "Powerlines build plugin starting...");
|
|
59
|
+
await ctx.$$internal.callHook("buildStart", { sequential: true });
|
|
60
|
+
}
|
|
61
|
+
async function transform(code, id) {
|
|
62
|
+
let transformed = code;
|
|
63
|
+
for (const hook of ctx.$$internal.environment.selectHooks("transform")) {
|
|
64
|
+
const result = await hook.handler.apply(combineContexts(ctx, this), [getString(transformed), id]);
|
|
65
|
+
if (result) transformed = result;
|
|
66
|
+
}
|
|
67
|
+
return transformed;
|
|
68
|
+
}
|
|
69
|
+
async function buildEnd() {
|
|
70
|
+
log(LogLevelLabel.DEBUG, "Powerlines build plugin finishing...");
|
|
71
|
+
return ctx.$$internal.callHook("buildEnd", { sequential: true });
|
|
72
|
+
}
|
|
73
|
+
async function writeBundle() {
|
|
74
|
+
log(LogLevelLabel.DEBUG, "Finalizing Powerlines project output...");
|
|
75
|
+
return ctx.$$internal.callHook("writeBundle", { sequential: true });
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
name: name.toLowerCase() === "unplugin" ? "powerlines" : `powerlines:${kebabCase(name)}`,
|
|
79
|
+
api: ctx.$$internal.api,
|
|
80
|
+
resolveId: {
|
|
81
|
+
filter: { id: { include: [/.*/] } },
|
|
82
|
+
handler: resolveId
|
|
83
|
+
},
|
|
84
|
+
load: {
|
|
85
|
+
filter: { id: { include: [/.*/] } },
|
|
86
|
+
handler: load
|
|
87
|
+
},
|
|
88
|
+
transform,
|
|
89
|
+
buildStart,
|
|
90
|
+
buildEnd,
|
|
91
|
+
writeBundle,
|
|
92
|
+
vite: { sharedDuringBuild: true }
|
|
93
|
+
};
|
|
94
|
+
} catch (error) {
|
|
95
|
+
log(LogLevelLabel.FATAL, error?.message);
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
//#endregion
|
|
102
|
+
export { createUnplugin, createUnpluginResolver };
|
|
103
|
+
//# sourceMappingURL=plugin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.mjs","names":["transformed: TransformResult | string","result: TransformResult | string | undefined"],"sources":["../../../src/lib/unplugin/plugin.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 { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport type {\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { setParseImpl } from \"unplugin\";\nimport { UNSAFE_PluginContext } from \"../../types/_internal\";\nimport { PluginContext } from \"../../types/context\";\nimport { UnpluginFactory } from \"../../types/unplugin\";\nimport { extendLog } from \"../logger\";\nimport { getString } from \"../utilities/source-file\";\nimport { combineContexts } from \"./helpers\";\nimport { createUnpluginModuleResolutionFunctions } from \"./module-resolution\";\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnpluginResolver<\n TContext extends PluginContext = PluginContext\n>(context: TContext, name = \"unplugin\"): UnpluginFactory<TContext> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n setParseImpl(ctx.parse);\n\n return () => {\n const log = extendLog(ctx.log, name);\n log(\n LogLevelLabel.DEBUG,\n `Initializing ${\n name.toLowerCase() === \"unplugin\"\n ? \"Unplugin\"\n : `${titleCase(name)} - Unplugin`\n } plugin`\n );\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context);\n\n return {\n name:\n name.toLowerCase() === \"unplugin\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.$$internal.api,\n resolveId: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: resolveId\n },\n load: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: load\n }\n };\n } catch (error) {\n log(LogLevelLabel.FATAL, (error as Error)?.message);\n\n throw error;\n }\n };\n}\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnplugin<TContext extends PluginContext = PluginContext>(\n context: TContext,\n name = \"unplugin\"\n): UnpluginFactory<TContext> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n setParseImpl(ctx.parse);\n\n return () => {\n const log = extendLog(ctx.log, name);\n log(\n LogLevelLabel.DEBUG,\n `Initializing ${\n name.toLowerCase() === \"unplugin\"\n ? \"Unplugin\"\n : `${titleCase(name)} - Unplugin`\n } plugin`\n );\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context);\n\n async function buildStart(this: UnpluginBuildContext) {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin starting...\");\n\n await ctx.$$internal.callHook(\"buildStart\", {\n sequential: true\n });\n }\n\n async function transform(\n this: UnpluginBuildContext & UnpluginContext,\n code: string,\n id: string\n ): Promise<TransformResult | null | undefined> {\n let transformed: TransformResult | string = code;\n\n for (const hook of ctx.$$internal.environment.selectHooks(\n \"transform\"\n )) {\n const result: TransformResult | string | undefined =\n await hook.handler.apply(combineContexts(ctx, this), [\n getString(transformed),\n id\n ]);\n if (result) {\n transformed = result;\n }\n }\n\n return transformed;\n }\n\n async function buildEnd(this: UnpluginBuildContext): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin finishing...\");\n\n return ctx.$$internal.callHook(\"buildEnd\", {\n sequential: true\n });\n }\n\n async function writeBundle(): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Finalizing Powerlines project output...\");\n\n return ctx.$$internal.callHook(\"writeBundle\", {\n sequential: true\n });\n }\n\n return {\n name:\n name.toLowerCase() === \"unplugin\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.$$internal.api,\n resolveId: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: resolveId\n },\n load: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: load\n },\n transform,\n buildStart,\n buildEnd,\n writeBundle,\n vite: {\n sharedDuringBuild: true\n }\n };\n } catch (error) {\n log(LogLevelLabel.FATAL, (error as Error)?.message);\n\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyCA,SAAgB,uBAEd,SAAmB,OAAO,YAAuC;CACjE,MAAM,MAAM;AACZ,cAAa,IAAI,MAAM;AAEvB,cAAa;EACX,MAAM,MAAM,UAAU,IAAI,KAAK,KAAK;AACpC,MACE,cAAc,OACd,gBACE,KAAK,aAAa,KAAK,aACnB,aACA,GAAG,UAAU,KAAK,CAAC,aACxB,SACF;AAED,MAAI;GACF,MAAM,EAAE,WAAW,SACjB,wCAAkD,QAAQ;AAE5D,UAAO;IACL,MACE,KAAK,aAAa,KAAK,aACnB,eACA,cAAc,UAAU,KAAK;IACnC,KAAK,IAAI,WAAW;IACpB,WAAW;KACT,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACD,MAAM;KACJ,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACF;WACM,OAAO;AACd,OAAI,cAAc,OAAQ,OAAiB,QAAQ;AAEnD,SAAM;;;;;;;;;;AAWZ,SAAgB,eACd,SACA,OAAO,YACoB;CAC3B,MAAM,MAAM;AACZ,cAAa,IAAI,MAAM;AAEvB,cAAa;EACX,MAAM,MAAM,UAAU,IAAI,KAAK,KAAK;AACpC,MACE,cAAc,OACd,gBACE,KAAK,aAAa,KAAK,aACnB,aACA,GAAG,UAAU,KAAK,CAAC,aACxB,SACF;AAED,MAAI;GACF,MAAM,EAAE,WAAW,SACjB,wCAAkD,QAAQ;GAE5D,eAAe,aAAuC;AACpD,QAAI,cAAc,OAAO,sCAAsC;AAE/D,UAAM,IAAI,WAAW,SAAS,cAAc,EAC1C,YAAY,MACb,CAAC;;GAGJ,eAAe,UAEb,MACA,IAC6C;IAC7C,IAAIA,cAAwC;AAE5C,SAAK,MAAM,QAAQ,IAAI,WAAW,YAAY,YAC5C,YACD,EAAE;KACD,MAAMC,SACJ,MAAM,KAAK,QAAQ,MAAM,gBAAgB,KAAK,KAAK,EAAE,CACnD,UAAU,YAAY,EACtB,GACD,CAAC;AACJ,SAAI,OACF,eAAc;;AAIlB,WAAO;;GAGT,eAAe,WAAoD;AACjE,QAAI,cAAc,OAAO,uCAAuC;AAEhE,WAAO,IAAI,WAAW,SAAS,YAAY,EACzC,YAAY,MACb,CAAC;;GAGJ,eAAe,cAA6B;AAC1C,QAAI,cAAc,OAAO,0CAA0C;AAEnE,WAAO,IAAI,WAAW,SAAS,eAAe,EAC5C,YAAY,MACb,CAAC;;AAGJ,UAAO;IACL,MACE,KAAK,aAAa,KAAK,aACnB,eACA,cAAc,UAAU,KAAK;IACnC,KAAK,IAAI,WAAW;IACpB,WAAW;KACT,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACD,MAAM;KACJ,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACD;IACA;IACA;IACA;IACA,MAAM,EACJ,mBAAmB,MACpB;IACF;WACM,OAAO;AACd,OAAI,cAAc,OAAQ,OAAiB,QAAQ;AAEnD,SAAM"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
3
|
+
|
|
4
|
+
//#region src/lib/utilities/file-header.ts
|
|
5
|
+
function getBaseFileHeader(context) {
|
|
6
|
+
return `
|
|
7
|
+
// Generated with ${(0, __stryke_string_format_title_case.titleCase)(context.config.framework)}
|
|
8
|
+
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
9
|
+
`;
|
|
10
|
+
}
|
|
11
|
+
function getFileHeader(context, options = {}) {
|
|
12
|
+
const { directive = null, prettierIgnore = false } = options;
|
|
13
|
+
return `/* eslint-disable */
|
|
14
|
+
// biome-ignore lint: disable
|
|
15
|
+
${prettierIgnore ? `// prettier-ignore` : ""}${directive ? `\n\n${directive}\n` : "\n"}
|
|
16
|
+
${getBaseFileHeader(context)}
|
|
17
|
+
|
|
18
|
+
`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.getBaseFileHeader = getBaseFileHeader;
|
|
23
|
+
exports.getFileHeader = getFileHeader;
|
|
24
|
+
//# sourceMappingURL=file-header.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-header.cjs","names":[],"sources":["../../../src/lib/utilities/file-header.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 { titleCase } from \"@stryke/string-format/title-case\";\nimport { Context } from \"../../types/context\";\n\nexport interface FileHeaderOptions {\n directive?: string | null;\n prettierIgnore?: boolean;\n}\n\nexport function getBaseFileHeader(context: Context): string {\n return `\n// Generated with ${titleCase(context.config.framework)}\n// Note: Do not edit this file manually - it will be overwritten automatically\n`;\n}\n\nexport function getFileHeader(\n context: Context,\n options: FileHeaderOptions = {}\n): string {\n const { directive = null, prettierIgnore = false } = options;\n\n return `/* eslint-disable */\n// biome-ignore lint: disable\n${prettierIgnore ? `// prettier-ignore` : \"\"}${directive ? `\\n\\n${directive}\\n` : \"\\n\"}\n${getBaseFileHeader(context)}\n\n`;\n}\n"],"mappings":";;;;AA0BA,SAAgB,kBAAkB,SAA0B;AAC1D,QAAO;qEACqB,QAAQ,OAAO,UAAU,CAAC;;;;AAKxD,SAAgB,cACd,SACA,UAA6B,EAAE,EACvB;CACR,MAAM,EAAE,YAAY,MAAM,iBAAiB,UAAU;AAErD,QAAO;;EAEP,iBAAiB,uBAAuB,KAAK,YAAY,OAAO,UAAU,MAAM,KAAK;EACrF,kBAAkB,QAAQ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Context } from "../../types/context.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/utilities/file-header.d.ts
|
|
4
|
+
interface FileHeaderOptions {
|
|
5
|
+
directive?: string | null;
|
|
6
|
+
prettierIgnore?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare function getBaseFileHeader(context: Context): string;
|
|
9
|
+
declare function getFileHeader(context: Context, options?: FileHeaderOptions): string;
|
|
10
|
+
declare type __ΩFileHeaderOptions = any[];
|
|
11
|
+
//#endregion
|
|
12
|
+
export { FileHeaderOptions, __ΩFileHeaderOptions, getBaseFileHeader, getFileHeader };
|
|
13
|
+
//# sourceMappingURL=file-header.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-header.d.cts","names":[],"sources":["../../../src/lib/utilities/file-header.ts"],"sourcesContent":[],"mappings":";;;UAqBiB,iBAAA;;EAAA,cAAA,CAAA,EAAA,OAAiB;AAKlC;AAOgB,iBAPA,iBAAA,CASL,OAAA,EATgC,OAShC,CAAA,EAAsB,MAAA;iBAFjB,aAAA,UACL,mBACA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Context } from "../../types/context.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/utilities/file-header.d.ts
|
|
4
|
+
interface FileHeaderOptions {
|
|
5
|
+
directive?: string | null;
|
|
6
|
+
prettierIgnore?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare function getBaseFileHeader(context: Context): string;
|
|
9
|
+
declare function getFileHeader(context: Context, options?: FileHeaderOptions): string;
|
|
10
|
+
declare type __ΩFileHeaderOptions = any[];
|
|
11
|
+
//#endregion
|
|
12
|
+
export { FileHeaderOptions, __ΩFileHeaderOptions, getBaseFileHeader, getFileHeader };
|
|
13
|
+
//# sourceMappingURL=file-header.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-header.d.mts","names":[],"sources":["../../../src/lib/utilities/file-header.ts"],"sourcesContent":[],"mappings":";;;UAqBiB,iBAAA;;EAAA,cAAA,CAAA,EAAA,OAAiB;AAKlC;AAOgB,iBAPA,iBAAA,CASL,OAAA,EATgC,OAShC,CAAsB,EAAA,MAAA;iBAFjB,aAAA,UACL,mBACA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/utilities/file-header.ts
|
|
4
|
+
function getBaseFileHeader(context) {
|
|
5
|
+
return `
|
|
6
|
+
// Generated with ${titleCase(context.config.framework)}
|
|
7
|
+
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
8
|
+
`;
|
|
9
|
+
}
|
|
10
|
+
function getFileHeader(context, options = {}) {
|
|
11
|
+
const { directive = null, prettierIgnore = false } = options;
|
|
12
|
+
return `/* eslint-disable */
|
|
13
|
+
// biome-ignore lint: disable
|
|
14
|
+
${prettierIgnore ? `// prettier-ignore` : ""}${directive ? `\n\n${directive}\n` : "\n"}
|
|
15
|
+
${getBaseFileHeader(context)}
|
|
16
|
+
|
|
17
|
+
`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { getBaseFileHeader, getFileHeader };
|
|
22
|
+
//# sourceMappingURL=file-header.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-header.mjs","names":[],"sources":["../../../src/lib/utilities/file-header.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 { titleCase } from \"@stryke/string-format/title-case\";\nimport { Context } from \"../../types/context\";\n\nexport interface FileHeaderOptions {\n directive?: string | null;\n prettierIgnore?: boolean;\n}\n\nexport function getBaseFileHeader(context: Context): string {\n return `\n// Generated with ${titleCase(context.config.framework)}\n// Note: Do not edit this file manually - it will be overwritten automatically\n`;\n}\n\nexport function getFileHeader(\n context: Context,\n options: FileHeaderOptions = {}\n): string {\n const { directive = null, prettierIgnore = false } = options;\n\n return `/* eslint-disable */\n// biome-ignore lint: disable\n${prettierIgnore ? `// prettier-ignore` : \"\"}${directive ? `\\n\\n${directive}\\n` : \"\\n\"}\n${getBaseFileHeader(context)}\n\n`;\n}\n"],"mappings":";;;AA0BA,SAAgB,kBAAkB,SAA0B;AAC1D,QAAO;oBACW,UAAU,QAAQ,OAAO,UAAU,CAAC;;;;AAKxD,SAAgB,cACd,SACA,UAA6B,EAAE,EACvB;CACR,MAAM,EAAE,YAAY,MAAM,iBAAiB,UAAU;AAErD,QAAO;;EAEP,iBAAiB,uBAAuB,KAAK,YAAY,OAAO,UAAU,MAAM,KAAK;EACrF,kBAAkB,QAAQ,CAAC"}
|