@powerlines/plugin-env 0.15.4 → 0.15.6
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/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/babel/index.cjs +1 -0
- package/dist/babel/index.d.cts +1 -0
- package/dist/babel/index.d.mts +1 -0
- package/dist/babel/index.mjs +3 -0
- package/dist/babel/plugin.cjs +200 -0
- package/dist/babel/plugin.d.cts +8 -0
- package/dist/babel/plugin.d.mts +9 -0
- package/dist/babel/plugin.mjs +198 -0
- package/dist/components/docs.cjs +70 -3
- package/dist/components/docs.d.cts +8 -1
- package/dist/components/docs.d.mts +8 -1
- package/dist/components/docs.mjs +68 -2
- package/dist/components/env.cjs +574 -4
- package/dist/components/env.d.cts +19 -2
- package/dist/components/env.d.mts +19 -3
- package/dist/components/env.mjs +570 -2
- package/dist/components/index.cjs +5 -7
- package/dist/components/index.d.cts +2 -4
- package/dist/components/index.d.mts +2 -5
- package/dist/components/index.mjs +2 -4
- package/dist/deepkit/schemas/reflection.cjs +5368 -0
- package/dist/{plugin-BwuEBScL.d.cts → deepkit/schemas/reflection.d.cts} +1 -268
- package/dist/{plugin-BaInAuAh.d.mts → deepkit/schemas/reflection.d.mts} +59 -326
- package/dist/deepkit/schemas/reflection.mjs +5365 -0
- package/dist/deepkit/schemas/reflection2.cjs +4112 -0
- package/dist/deepkit/schemas/reflection2.mjs +4110 -0
- package/dist/deepkit/src/capnp.cjs +1692 -0
- package/dist/deepkit/src/capnp.mjs +1690 -0
- package/dist/deepkit/src/esbuild-plugin.cjs +99 -0
- package/dist/deepkit/src/esbuild-plugin.mjs +98 -0
- package/dist/deepkit/src/reflect-type.cjs +40 -0
- package/dist/deepkit/src/reflect-type.mjs +38 -0
- package/dist/deepkit/src/resolve-reflections.cjs +23 -0
- package/dist/deepkit/src/resolve-reflections.mjs +22 -0
- package/dist/deepkit/src/transformer.cjs +92 -0
- package/dist/deepkit/src/transformer.mjs +89 -0
- package/dist/deepkit/src/transpile.cjs +39 -0
- package/dist/deepkit/src/transpile.mjs +37 -0
- package/dist/deepkit/src/types.cjs +22 -0
- package/dist/deepkit/src/types.d.cts +10 -0
- package/dist/deepkit/src/types.d.mts +10 -0
- package/dist/deepkit/src/types.mjs +21 -0
- package/dist/deepkit/src/utilities.cjs +182 -0
- package/dist/deepkit/src/utilities.mjs +181 -0
- package/dist/helpers/automd-generator.cjs +32 -0
- package/dist/helpers/automd-generator.mjs +31 -0
- package/dist/helpers/create-reflection-resource.cjs +98 -0
- package/dist/helpers/create-reflection-resource.d.cts +15 -0
- package/dist/helpers/create-reflection-resource.d.mts +15 -0
- package/dist/helpers/create-reflection-resource.mjs +97 -0
- package/dist/helpers/index.cjs +6 -0
- package/dist/helpers/index.d.cts +6 -0
- package/dist/helpers/index.d.mts +6 -0
- package/dist/helpers/index.mjs +8 -0
- package/dist/helpers/load.cjs +134 -0
- package/dist/helpers/load.d.cts +35 -0
- package/dist/helpers/load.d.mts +36 -0
- package/dist/helpers/load.mjs +131 -0
- package/dist/helpers/persistence.cjs +320 -0
- package/dist/helpers/persistence.d.cts +84 -0
- package/dist/helpers/persistence.d.mts +84 -0
- package/dist/helpers/persistence.mjs +308 -0
- package/dist/helpers/reflect.cjs +263 -0
- package/dist/helpers/reflect.d.cts +46 -0
- package/dist/helpers/reflect.d.mts +46 -0
- package/dist/helpers/reflect.mjs +254 -0
- package/dist/helpers/source-file-env.cjs +58 -0
- package/dist/helpers/source-file-env.d.cts +8 -0
- package/dist/helpers/source-file-env.d.mts +8 -0
- package/dist/helpers/source-file-env.mjs +56 -0
- package/dist/helpers/template-helpers.cjs +70 -0
- package/dist/helpers/template-helpers.d.cts +15 -0
- package/dist/helpers/template-helpers.d.mts +15 -0
- package/dist/helpers/template-helpers.mjs +69 -0
- package/dist/index.cjs +82 -696
- package/dist/index.d.cts +16 -185
- package/dist/index.d.mts +17 -190
- package/dist/index.mjs +31 -648
- package/dist/plugin-alloy/src/core/components/output.cjs +45 -0
- package/dist/plugin-alloy/src/core/components/output.mjs +44 -0
- package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +22 -0
- package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +21 -0
- package/dist/plugin-alloy/src/core/components/source-file.cjs +64 -0
- package/dist/plugin-alloy/src/core/components/source-file.d.cts +23 -0
- package/dist/plugin-alloy/src/core/components/source-file.d.mts +23 -0
- package/dist/plugin-alloy/src/core/components/source-file.mjs +62 -0
- package/dist/plugin-alloy/src/core/contexts/context.cjs +136 -0
- package/dist/plugin-alloy/src/core/contexts/context.mjs +128 -0
- package/dist/plugin-alloy/src/core/contexts/index.cjs +2 -0
- package/dist/plugin-alloy/src/core/contexts/index.mjs +4 -0
- package/dist/plugin-alloy/src/core/contexts/reflection.cjs +110 -0
- package/dist/plugin-alloy/src/core/contexts/reflection.mjs +101 -0
- package/dist/plugin-alloy/src/helpers/refkey.cjs +23 -0
- package/dist/plugin-alloy/src/helpers/refkey.mjs +22 -0
- package/dist/plugin-alloy/src/index.cjs +93 -0
- package/dist/plugin-alloy/src/index.mjs +91 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +115 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +114 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +39 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +38 -0
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +72 -0
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +71 -0
- package/dist/plugin-alloy/src/types/components.cjs +22 -0
- package/dist/plugin-alloy/src/types/components.d.cts +22 -0
- package/dist/{components-8W0Zgj0y.d.mts → plugin-alloy/src/types/components.d.mts} +2 -1
- package/dist/plugin-alloy/src/types/components.mjs +21 -0
- package/dist/plugin-alloy/src/types/index.d.mts +2 -0
- package/dist/plugin-alloy/src/types/plugin.cjs +55 -0
- package/dist/plugin-alloy/src/types/plugin.d.cts +37 -0
- package/dist/plugin-alloy/src/types/plugin.d.mts +37 -0
- package/dist/plugin-alloy/src/types/plugin.mjs +52 -0
- package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +57 -0
- package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +25 -0
- package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +26 -0
- package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +56 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +126 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +124 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +442 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +27 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +28 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +433 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +194 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +14 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +15 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +191 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +68 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.cts +11 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +12 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +67 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +124 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +123 -0
- package/dist/plugin-automd/src/index.cjs +127 -0
- package/dist/plugin-automd/src/index.mjs +124 -0
- package/dist/plugin-automd/src/types/plugin.cjs +47 -0
- package/dist/plugin-automd/src/types/plugin.d.cts +38 -0
- package/dist/plugin-automd/src/types/plugin.d.mts +40 -0
- package/dist/plugin-automd/src/types/plugin.mjs +47 -0
- package/dist/plugin-automd/src/types/toc.cjs +26 -0
- package/dist/plugin-automd/src/types/toc.d.cts +33 -0
- package/dist/plugin-automd/src/types/toc.d.mts +33 -0
- package/dist/plugin-automd/src/types/toc.mjs +25 -0
- package/dist/plugin-babel/src/helpers/ast-utils.cjs +74 -0
- package/dist/plugin-babel/src/helpers/ast-utils.mjs +70 -0
- package/dist/plugin-babel/src/helpers/create-plugin.cjs +71 -0
- package/dist/plugin-babel/src/helpers/create-plugin.mjs +69 -0
- package/dist/plugin-babel/src/helpers/filters.cjs +158 -0
- package/dist/plugin-babel/src/helpers/filters.mjs +154 -0
- package/dist/plugin-babel/src/helpers/index.cjs +5 -0
- package/dist/plugin-babel/src/helpers/index.mjs +7 -0
- package/dist/plugin-babel/src/helpers/module-helpers.cjs +200 -0
- package/dist/plugin-babel/src/helpers/module-helpers.mjs +192 -0
- package/dist/plugin-babel/src/helpers/options.cjs +74 -0
- package/dist/plugin-babel/src/helpers/options.mjs +71 -0
- package/dist/plugin-babel/src/index.cjs +134 -0
- package/dist/plugin-babel/src/index.mjs +132 -0
- package/dist/plugin-babel/src/types/index.d.mts +1 -0
- package/dist/plugin-babel/src/types/plugin.cjs +42 -0
- package/dist/plugin-babel/src/types/plugin.d.cts +15 -0
- package/dist/plugin-babel/src/types/plugin.d.mts +15 -0
- package/dist/plugin-babel/src/types/plugin.mjs +39 -0
- package/dist/powerlines/schemas/fs.d.mts +1 -0
- package/dist/powerlines/src/api.d.mts +7 -0
- package/dist/powerlines/src/index.d.mts +12 -0
- package/dist/powerlines/src/internal/helpers/hooks.cjs +119 -0
- package/dist/powerlines/src/internal/helpers/hooks.d.mts +5 -0
- package/dist/powerlines/src/internal/helpers/hooks.mjs +118 -0
- package/dist/powerlines/src/lib/build/esbuild.cjs +161 -0
- package/dist/powerlines/src/lib/build/esbuild.mjs +159 -0
- package/dist/powerlines/src/lib/entry.cjs +203 -0
- package/dist/powerlines/src/lib/entry.mjs +201 -0
- package/dist/powerlines/src/lib/logger.cjs +108 -0
- package/dist/powerlines/src/lib/logger.mjs +106 -0
- package/dist/powerlines/src/lib/utilities/bundle.cjs +67 -0
- package/dist/powerlines/src/lib/utilities/bundle.mjs +66 -0
- package/dist/powerlines/src/lib/utilities/resolve.cjs +49 -0
- package/dist/powerlines/src/lib/utilities/resolve.mjs +48 -0
- package/dist/powerlines/src/plugin-utils/paths.cjs +46 -0
- package/dist/powerlines/src/plugin-utils/paths.mjs +45 -0
- package/dist/powerlines/src/types/api.cjs +1 -0
- package/dist/powerlines/src/types/api.d.mts +5 -0
- package/dist/powerlines/src/types/api.mjs +3 -0
- package/dist/powerlines/src/types/babel.cjs +156 -0
- package/dist/powerlines/src/types/babel.d.cts +23 -0
- package/dist/powerlines/src/types/babel.d.mts +23 -0
- package/dist/powerlines/src/types/babel.mjs +147 -0
- package/dist/powerlines/src/types/build.cjs +105 -0
- package/dist/powerlines/src/types/build.d.cts +145 -0
- package/dist/powerlines/src/types/build.d.mts +147 -0
- package/dist/powerlines/src/types/build.mjs +101 -0
- package/dist/powerlines/src/types/commands.cjs +16 -0
- package/dist/powerlines/src/types/commands.d.cts +8 -0
- package/dist/powerlines/src/types/commands.d.mts +9 -0
- package/dist/powerlines/src/types/commands.mjs +15 -0
- package/dist/powerlines/src/types/config.cjs +306 -0
- package/dist/powerlines/src/types/config.d.cts +387 -0
- package/dist/powerlines/src/types/config.d.mts +388 -0
- package/dist/powerlines/src/types/config.mjs +293 -0
- package/dist/powerlines/src/types/context.cjs +324 -0
- package/dist/powerlines/src/types/context.d.cts +414 -0
- package/dist/powerlines/src/types/context.d.mts +416 -0
- package/dist/powerlines/src/types/context.mjs +311 -0
- package/dist/powerlines/src/types/fs.cjs +78 -0
- package/dist/powerlines/src/types/fs.d.cts +486 -0
- package/dist/powerlines/src/types/fs.d.mts +486 -0
- package/dist/powerlines/src/types/fs.mjs +75 -0
- package/dist/powerlines/src/types/hooks.cjs +52 -0
- package/dist/powerlines/src/types/hooks.d.mts +2 -0
- package/dist/powerlines/src/types/hooks.mjs +48 -0
- package/dist/powerlines/src/types/index.cjs +11 -0
- package/dist/powerlines/src/types/index.d.mts +12 -0
- package/dist/powerlines/src/types/index.mjs +13 -0
- package/dist/powerlines/src/types/plugin.cjs +249 -0
- package/dist/powerlines/src/types/plugin.d.cts +231 -0
- package/dist/powerlines/src/types/plugin.d.mts +231 -0
- package/dist/powerlines/src/types/plugin.mjs +240 -0
- package/dist/powerlines/src/types/resolved.cjs +153 -0
- package/dist/powerlines/src/types/resolved.d.cts +82 -0
- package/dist/powerlines/src/types/resolved.d.mts +83 -0
- package/dist/powerlines/src/types/resolved.mjs +148 -0
- package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
- package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
- package/dist/powerlines/src/types/unplugin.cjs +1 -0
- package/dist/powerlines/src/types/unplugin.d.mts +7 -0
- package/dist/powerlines/src/types/unplugin.mjs +3 -0
- package/dist/types/index.cjs +10 -3
- package/dist/types/index.d.cts +2 -4
- package/dist/types/index.d.mts +2 -5
- package/dist/types/index.mjs +3 -4
- package/dist/types/plugin.cjs +133 -1
- package/dist/types/plugin.d.cts +156 -3
- package/dist/types/plugin.d.mts +158 -4
- package/dist/types/plugin.mjs +128 -2
- package/dist/types/runtime.cjs +242 -1
- package/dist/types/runtime.d.cts +793 -2
- package/dist/types/runtime.d.mts +793 -2
- package/dist/types/runtime.mjs +240 -2
- package/package.json +13 -9
- package/dist/components-C9bYrQVK.cjs +0 -0
- package/dist/components-CNIQFfeK.mjs +0 -1
- package/dist/create-reflection-resource-BNYxBgW2.mjs +0 -9846
- package/dist/create-reflection-resource-BWYhmX7O.cjs +0 -10085
- package/dist/docs-5r844zC1.d.mts +0 -9
- package/dist/docs-B66b9li3.mjs +0 -219
- package/dist/docs-_MmTNBQX.d.cts +0 -9
- package/dist/docs-hBlKCRWK.cjs +0 -224
- package/dist/env-BPodCdD1.d.cts +0 -116
- package/dist/env-IQvgnabX.mjs +0 -1578
- package/dist/env-cO4BUDn1.cjs +0 -1596
- package/dist/env-zhzvpUI5.d.mts +0 -98
- package/dist/index-BXxhKmeA.d.mts +0 -1
- package/dist/index-Cc7fCJU9.d.mts +0 -1
- package/dist/index-CqdNToYT.d.cts +0 -1
- package/dist/index-DWPDThxu.d.cts +0 -1
- package/dist/plugin-D3B5E_Hg.mjs +0 -1
- package/dist/plugin-D5qyQPqC.cjs +0 -0
- package/dist/resolved-BZG2cwRG.d.cts +0 -1789
- package/dist/resolved-V5COsfDu.d.mts +0 -1791
- package/dist/runtime-Bisl_1Ja.cjs +0 -0
- package/dist/runtime-Q8Ni8SeN.d.cts +0 -794
- package/dist/runtime-azNoeKr-.mjs +0 -1
- package/dist/runtime-qZ0Z2kEd.d.mts +0 -794
- package/dist/types-DwElXV6q.mjs +0 -1
- package/dist/types-MYBaygjr.cjs +0 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_toc = require('./types/toc.cjs');
|
|
3
|
+
const require_plugin = require('./types/plugin.cjs');
|
|
4
|
+
const require_plugin$1 = require('../../powerlines/src/types/plugin.cjs');
|
|
5
|
+
let __stryke_path_replace = require("@stryke/path/replace");
|
|
6
|
+
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
7
|
+
let __stryke_fs_is_file = require("@stryke/fs/is-file");
|
|
8
|
+
let __stryke_fs_list_files = require("@stryke/fs/list-files");
|
|
9
|
+
let __stryke_path_append = require("@stryke/path/append");
|
|
10
|
+
let __stryke_path_is_type = require("@stryke/path/is-type");
|
|
11
|
+
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
12
|
+
let automd = require("automd");
|
|
13
|
+
let c12 = require("c12");
|
|
14
|
+
let defu = require("defu");
|
|
15
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
16
|
+
let markdown_toc = require("markdown-toc");
|
|
17
|
+
markdown_toc = require_rolldown_runtime.__toESM(markdown_toc);
|
|
18
|
+
|
|
19
|
+
//#region ../plugin-automd/src/index.ts
|
|
20
|
+
function __assignType(fn, args) {
|
|
21
|
+
fn.__type = args;
|
|
22
|
+
return fn;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* AutoMD Plugin
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* A Powerlines plugin to use the AutoMD markdown transformer during the prepare task.
|
|
29
|
+
*
|
|
30
|
+
* @see https://automd.unjs.io/
|
|
31
|
+
*
|
|
32
|
+
* @param options - The plugin options.
|
|
33
|
+
* @returns A Powerlines plugin instance.
|
|
34
|
+
*/
|
|
35
|
+
const plugin = __assignType((options = {}) => {
|
|
36
|
+
return {
|
|
37
|
+
name: "automd",
|
|
38
|
+
config: __assignType(async function config() {
|
|
39
|
+
const config$1 = await (0, automd.loadConfig)((0, __stryke_path_join_paths.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot), options);
|
|
40
|
+
if (!config$1.prefix || !Array.isArray(config$1.prefix)) config$1.prefix = (0, __stryke_convert_to_array.toArray)(config$1.prefix ?? []);
|
|
41
|
+
if (!config$1.prefix.includes("automd")) config$1.prefix.push("automd");
|
|
42
|
+
if (!config$1.prefix.includes("powerlines")) config$1.prefix.push("powerlines");
|
|
43
|
+
return { automd: (0, defu.default)(config$1 ?? {}, {
|
|
44
|
+
configFile: options.configFile,
|
|
45
|
+
allowIssues: true,
|
|
46
|
+
dir: this.config.projectRoot,
|
|
47
|
+
watch: false,
|
|
48
|
+
input: "README.md",
|
|
49
|
+
toc: {
|
|
50
|
+
maxDepth: 6,
|
|
51
|
+
bullets: "-"
|
|
52
|
+
}
|
|
53
|
+
}) };
|
|
54
|
+
}, ["config", "P\"/!"]),
|
|
55
|
+
async configResolved() {
|
|
56
|
+
if (this.config.framework && !(0, __stryke_convert_to_array.toArray)(this.config.automd.prefix).includes(this.config.framework)) this.config.automd.prefix = (0, __stryke_convert_to_array.toArray)(this.config.automd.prefix).concat(this.config.framework);
|
|
57
|
+
if (this.config.automd.configFile) {
|
|
58
|
+
const { config } = await (c12.loadConfig.Ω = [["!"]], (0, c12.loadConfig)({
|
|
59
|
+
cwd: this.config.automd.dir,
|
|
60
|
+
configFile: this.config.automd.configFile,
|
|
61
|
+
defaults: {
|
|
62
|
+
ignore: [
|
|
63
|
+
"**/node_modules",
|
|
64
|
+
"**/dist",
|
|
65
|
+
"**/.*"
|
|
66
|
+
],
|
|
67
|
+
dir: this.config.automd.dir
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
this.config.automd = (0, automd.resolveConfig)((0, defu.default)(this.config.automd, {
|
|
71
|
+
...config,
|
|
72
|
+
prefix: (0, __stryke_convert_to_array.toArray)(config.prefix ?? [])
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
this.config.automd.input = (await Promise.all((0, __stryke_convert_to_array.toArray)(this.config.automd.input).map(__assignType(async (input) => {
|
|
76
|
+
if (input.includes("*")) return (0, __stryke_fs_list_files.listFiles)((0, __stryke_path_is_type.isAbsolutePath)(input) ? input : (0, __stryke_path_append.appendPath)(input, this.config.projectRoot), { ignore: this.config.automd.ignore });
|
|
77
|
+
return (0, __stryke_path_is_type.isAbsolutePath)(input) ? input : (0, __stryke_path_append.appendPath)(input, this.config.projectRoot);
|
|
78
|
+
}, [
|
|
79
|
+
"input",
|
|
80
|
+
"",
|
|
81
|
+
"P\"2!\"/\""
|
|
82
|
+
])))).flat();
|
|
83
|
+
if (this.config.automd.output && !(0, __stryke_path_is_type.isAbsolutePath)(this.config.automd.output)) this.config.automd.output = (0, __stryke_path_append.appendPath)(this.config.automd.output, this.config.projectRoot);
|
|
84
|
+
this.config.automd.generators ??= {};
|
|
85
|
+
if (this.config.automd.toc !== false) this.config.automd.generators.toc ??= {
|
|
86
|
+
name: "toc",
|
|
87
|
+
generate: __assignType((ctx) => {
|
|
88
|
+
const opts = this.config.automd.toc ?? {};
|
|
89
|
+
return { contents: (0, markdown_toc.default)(ctx.block.md, {
|
|
90
|
+
...opts,
|
|
91
|
+
maxdepth: opts.maxDepth,
|
|
92
|
+
first1: opts.firstH1
|
|
93
|
+
}).content };
|
|
94
|
+
}, [
|
|
95
|
+
"ctx",
|
|
96
|
+
"",
|
|
97
|
+
"P!2!!/\""
|
|
98
|
+
])
|
|
99
|
+
};
|
|
100
|
+
},
|
|
101
|
+
async docs() {
|
|
102
|
+
await Promise.all((0, __stryke_convert_to_array.toArray)(this.config.automd.input).map(__assignType(async (input) => {
|
|
103
|
+
const contents = await this.fs.read(input);
|
|
104
|
+
if (contents) {
|
|
105
|
+
const result = await (0, automd.transform)(contents, this.config.automd);
|
|
106
|
+
if (result.hasIssues && this.config.automd.allowIssues === false) throw new Error(`AutoMD found issues in file "${input}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);
|
|
107
|
+
if (result.hasChanged) await this.fs.write((0, __stryke_path_append.appendPath)(this.config.automd.output ? (0, __stryke_fs_is_file.isDirectory)(this.config.automd.output) ? (0, __stryke_path_replace.replacePath)(input, this.config.automd.output) : this.config.automd.output : input, this.config.projectRoot), result.contents);
|
|
108
|
+
}
|
|
109
|
+
}, [
|
|
110
|
+
"input",
|
|
111
|
+
"",
|
|
112
|
+
"P\"2!\"/\""
|
|
113
|
+
])));
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}, [
|
|
117
|
+
() => require_plugin.__ΩAutoMDPluginOptions,
|
|
118
|
+
"options",
|
|
119
|
+
() => ({}),
|
|
120
|
+
() => require_plugin$1.__ΩPlugin,
|
|
121
|
+
"",
|
|
122
|
+
"Pn!2\">#\"o$\"/%"
|
|
123
|
+
]);
|
|
124
|
+
var src_default = plugin;
|
|
125
|
+
|
|
126
|
+
//#endregion
|
|
127
|
+
exports.default = src_default;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { __ΩTOCOptions } from "./types/toc.mjs";
|
|
2
|
+
import { __ΩAutoMDPluginOptions } from "./types/plugin.mjs";
|
|
3
|
+
import { __ΩPlugin } from "../../powerlines/src/types/plugin.mjs";
|
|
4
|
+
import { replacePath } from "@stryke/path/replace";
|
|
5
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
6
|
+
import { isDirectory } from "@stryke/fs/is-file";
|
|
7
|
+
import { listFiles } from "@stryke/fs/list-files";
|
|
8
|
+
import { appendPath } from "@stryke/path/append";
|
|
9
|
+
import { isAbsolutePath } from "@stryke/path/is-type";
|
|
10
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
11
|
+
import { loadConfig, resolveConfig, transform } from "automd";
|
|
12
|
+
import { loadConfig as loadConfig$1 } from "c12";
|
|
13
|
+
import defu$1 from "defu";
|
|
14
|
+
import toc from "markdown-toc";
|
|
15
|
+
|
|
16
|
+
//#region ../plugin-automd/src/index.ts
|
|
17
|
+
function __assignType(fn, args) {
|
|
18
|
+
fn.__type = args;
|
|
19
|
+
return fn;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* AutoMD Plugin
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* A Powerlines plugin to use the AutoMD markdown transformer during the prepare task.
|
|
26
|
+
*
|
|
27
|
+
* @see https://automd.unjs.io/
|
|
28
|
+
*
|
|
29
|
+
* @param options - The plugin options.
|
|
30
|
+
* @returns A Powerlines plugin instance.
|
|
31
|
+
*/
|
|
32
|
+
const plugin = __assignType((options = {}) => {
|
|
33
|
+
return {
|
|
34
|
+
name: "automd",
|
|
35
|
+
config: __assignType(async function config() {
|
|
36
|
+
const config$1 = await loadConfig(joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot), options);
|
|
37
|
+
if (!config$1.prefix || !Array.isArray(config$1.prefix)) config$1.prefix = toArray(config$1.prefix ?? []);
|
|
38
|
+
if (!config$1.prefix.includes("automd")) config$1.prefix.push("automd");
|
|
39
|
+
if (!config$1.prefix.includes("powerlines")) config$1.prefix.push("powerlines");
|
|
40
|
+
return { automd: defu$1(config$1 ?? {}, {
|
|
41
|
+
configFile: options.configFile,
|
|
42
|
+
allowIssues: true,
|
|
43
|
+
dir: this.config.projectRoot,
|
|
44
|
+
watch: false,
|
|
45
|
+
input: "README.md",
|
|
46
|
+
toc: {
|
|
47
|
+
maxDepth: 6,
|
|
48
|
+
bullets: "-"
|
|
49
|
+
}
|
|
50
|
+
}) };
|
|
51
|
+
}, ["config", "P\"/!"]),
|
|
52
|
+
async configResolved() {
|
|
53
|
+
if (this.config.framework && !toArray(this.config.automd.prefix).includes(this.config.framework)) this.config.automd.prefix = toArray(this.config.automd.prefix).concat(this.config.framework);
|
|
54
|
+
if (this.config.automd.configFile) {
|
|
55
|
+
const { config } = await (loadConfig$1.Ω = [["!"]], loadConfig$1({
|
|
56
|
+
cwd: this.config.automd.dir,
|
|
57
|
+
configFile: this.config.automd.configFile,
|
|
58
|
+
defaults: {
|
|
59
|
+
ignore: [
|
|
60
|
+
"**/node_modules",
|
|
61
|
+
"**/dist",
|
|
62
|
+
"**/.*"
|
|
63
|
+
],
|
|
64
|
+
dir: this.config.automd.dir
|
|
65
|
+
}
|
|
66
|
+
}));
|
|
67
|
+
this.config.automd = resolveConfig(defu$1(this.config.automd, {
|
|
68
|
+
...config,
|
|
69
|
+
prefix: toArray(config.prefix ?? [])
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
this.config.automd.input = (await Promise.all(toArray(this.config.automd.input).map(__assignType(async (input) => {
|
|
73
|
+
if (input.includes("*")) return listFiles(isAbsolutePath(input) ? input : appendPath(input, this.config.projectRoot), { ignore: this.config.automd.ignore });
|
|
74
|
+
return isAbsolutePath(input) ? input : appendPath(input, this.config.projectRoot);
|
|
75
|
+
}, [
|
|
76
|
+
"input",
|
|
77
|
+
"",
|
|
78
|
+
"P\"2!\"/\""
|
|
79
|
+
])))).flat();
|
|
80
|
+
if (this.config.automd.output && !isAbsolutePath(this.config.automd.output)) this.config.automd.output = appendPath(this.config.automd.output, this.config.projectRoot);
|
|
81
|
+
this.config.automd.generators ??= {};
|
|
82
|
+
if (this.config.automd.toc !== false) this.config.automd.generators.toc ??= {
|
|
83
|
+
name: "toc",
|
|
84
|
+
generate: __assignType((ctx) => {
|
|
85
|
+
const opts = this.config.automd.toc ?? {};
|
|
86
|
+
return { contents: toc(ctx.block.md, {
|
|
87
|
+
...opts,
|
|
88
|
+
maxdepth: opts.maxDepth,
|
|
89
|
+
first1: opts.firstH1
|
|
90
|
+
}).content };
|
|
91
|
+
}, [
|
|
92
|
+
"ctx",
|
|
93
|
+
"",
|
|
94
|
+
"P!2!!/\""
|
|
95
|
+
])
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
async docs() {
|
|
99
|
+
await Promise.all(toArray(this.config.automd.input).map(__assignType(async (input) => {
|
|
100
|
+
const contents = await this.fs.read(input);
|
|
101
|
+
if (contents) {
|
|
102
|
+
const result = await transform(contents, this.config.automd);
|
|
103
|
+
if (result.hasIssues && this.config.automd.allowIssues === false) throw new Error(`AutoMD found issues in file "${input}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);
|
|
104
|
+
if (result.hasChanged) await this.fs.write(appendPath(this.config.automd.output ? isDirectory(this.config.automd.output) ? replacePath(input, this.config.automd.output) : this.config.automd.output : input, this.config.projectRoot), result.contents);
|
|
105
|
+
}
|
|
106
|
+
}, [
|
|
107
|
+
"input",
|
|
108
|
+
"",
|
|
109
|
+
"P\"2!\"/\""
|
|
110
|
+
])));
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}, [
|
|
114
|
+
() => __ΩAutoMDPluginOptions,
|
|
115
|
+
"options",
|
|
116
|
+
() => ({}),
|
|
117
|
+
() => __ΩPlugin,
|
|
118
|
+
"",
|
|
119
|
+
"Pn!2\">#\"o$\"/%"
|
|
120
|
+
]);
|
|
121
|
+
var src_default = plugin;
|
|
122
|
+
|
|
123
|
+
//#endregion
|
|
124
|
+
export { src_default as default };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const require_toc = require('./toc.cjs');
|
|
2
|
+
|
|
3
|
+
//#region ../plugin-automd/src/types/plugin.ts
|
|
4
|
+
const __ΩOmit = [
|
|
5
|
+
"T",
|
|
6
|
+
"K",
|
|
7
|
+
() => __ΩPick,
|
|
8
|
+
() => __ΩExclude,
|
|
9
|
+
"Omit",
|
|
10
|
+
"b!b\"e!!e!!ge!\"o$#o##w%y"
|
|
11
|
+
];
|
|
12
|
+
const __ΩPick = [
|
|
13
|
+
"T",
|
|
14
|
+
"K",
|
|
15
|
+
"Pick",
|
|
16
|
+
"l+e#!e\"!fRb!b\"Pde\"\"N#!w#y"
|
|
17
|
+
];
|
|
18
|
+
const __ΩExclude = [
|
|
19
|
+
"T",
|
|
20
|
+
"U",
|
|
21
|
+
"Exclude",
|
|
22
|
+
"l6!Re$!RPe#!e$\"qk#%QRb!b\"Pde\"!p)w#y"
|
|
23
|
+
];
|
|
24
|
+
const __ΩAutoMDPluginOptions = [
|
|
25
|
+
() => __ΩOmit,
|
|
26
|
+
"dir",
|
|
27
|
+
"watch",
|
|
28
|
+
"onWatch",
|
|
29
|
+
"prefix",
|
|
30
|
+
"configFile",
|
|
31
|
+
"Path to the AutoMD configuration file.",
|
|
32
|
+
"allowIssues",
|
|
33
|
+
true,
|
|
34
|
+
"An indicator specifying whether or not issues found by AutoMD during the prepare task are considered fatal.",
|
|
35
|
+
"prefix",
|
|
36
|
+
"[\"automd\", \"powerlines\", \"\\{framework\\}\"]",
|
|
37
|
+
"Alternate prefix strings to use for finding generators",
|
|
38
|
+
false,
|
|
39
|
+
() => require_toc.__ΩTOCOptions,
|
|
40
|
+
"toc",
|
|
41
|
+
"Table of Contents generator options",
|
|
42
|
+
"AutoMDPluginOptions",
|
|
43
|
+
"P!P.\".#.$.%Jo!#P&4&8?')4(8>)?*P&&FJ4+8>,?-P..n/J408?1MKw2y"
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
exports.__ΩAutoMDPluginOptions = __ΩAutoMDPluginOptions;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { TOCOptions } from "./toc.cjs";
|
|
2
|
+
import { Config } from "automd";
|
|
3
|
+
|
|
4
|
+
//#region ../plugin-automd/src/types/plugin.d.ts
|
|
5
|
+
|
|
6
|
+
type AutoMDPluginOptions = Omit<Config, "dir" | "watch" | "onWatch" | "prefix"> & {
|
|
7
|
+
/**
|
|
8
|
+
* Path to the AutoMD configuration file.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* If not provided, the plugin will use the default AutoMD configuration resolution mechanism.
|
|
12
|
+
*/
|
|
13
|
+
configFile?: string;
|
|
14
|
+
/**
|
|
15
|
+
* An indicator specifying whether or not issues found by AutoMD during the prepare task are considered fatal.
|
|
16
|
+
*
|
|
17
|
+
* @defaultValue true
|
|
18
|
+
*/
|
|
19
|
+
allowIssues?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Alternate prefix strings to use for finding generators
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* By default, AutoMD looks for generators with the "automd" prefix, so that any `<!-- automd:generator [...args] --> ... <!-- /automd -->` comments will be picked up. If you want to use different prefixes (for example, to avoid conflicts with other tools), you would provide a value like "myPrefix" and AutoMD would also look for `<!-- myPrefix:generator [...args] --> ... <!-- /myPrefix -->` comments.
|
|
25
|
+
*
|
|
26
|
+
* @defaultValue ["automd", "powerlines", "\{framework\}"]
|
|
27
|
+
*/
|
|
28
|
+
prefix?: string | string[];
|
|
29
|
+
/**
|
|
30
|
+
* Table of Contents generator options
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* If set to `false`, the built-in Table of Contents generator will be disabled.
|
|
34
|
+
*/
|
|
35
|
+
toc?: false | TOCOptions;
|
|
36
|
+
};
|
|
37
|
+
//#endregion
|
|
38
|
+
export { AutoMDPluginOptions };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import "../../../powerlines/src/types/context.mjs";
|
|
2
|
+
import "../../../powerlines/src/types/config.mjs";
|
|
3
|
+
import "../../../powerlines/src/types/resolved.mjs";
|
|
4
|
+
import { TOCOptions } from "./toc.mjs";
|
|
5
|
+
import { Config } from "automd";
|
|
6
|
+
|
|
7
|
+
//#region ../plugin-automd/src/types/plugin.d.ts
|
|
8
|
+
type AutoMDPluginOptions = Omit<Config, "dir" | "watch" | "onWatch" | "prefix"> & {
|
|
9
|
+
/**
|
|
10
|
+
* Path to the AutoMD configuration file.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* If not provided, the plugin will use the default AutoMD configuration resolution mechanism.
|
|
14
|
+
*/
|
|
15
|
+
configFile?: string;
|
|
16
|
+
/**
|
|
17
|
+
* An indicator specifying whether or not issues found by AutoMD during the prepare task are considered fatal.
|
|
18
|
+
*
|
|
19
|
+
* @defaultValue true
|
|
20
|
+
*/
|
|
21
|
+
allowIssues?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Alternate prefix strings to use for finding generators
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* By default, AutoMD looks for generators with the "automd" prefix, so that any `<!-- automd:generator [...args] --> ... <!-- /automd -->` comments will be picked up. If you want to use different prefixes (for example, to avoid conflicts with other tools), you would provide a value like "myPrefix" and AutoMD would also look for `<!-- myPrefix:generator [...args] --> ... <!-- /myPrefix -->` comments.
|
|
27
|
+
*
|
|
28
|
+
* @defaultValue ["automd", "powerlines", "\{framework\}"]
|
|
29
|
+
*/
|
|
30
|
+
prefix?: string | string[];
|
|
31
|
+
/**
|
|
32
|
+
* Table of Contents generator options
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* If set to `false`, the built-in Table of Contents generator will be disabled.
|
|
36
|
+
*/
|
|
37
|
+
toc?: false | TOCOptions;
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
export { AutoMDPluginOptions };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { __ΩTOCOptions } from "./toc.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../plugin-automd/src/types/plugin.ts
|
|
4
|
+
const __ΩOmit = [
|
|
5
|
+
"T",
|
|
6
|
+
"K",
|
|
7
|
+
() => __ΩPick,
|
|
8
|
+
() => __ΩExclude,
|
|
9
|
+
"Omit",
|
|
10
|
+
"b!b\"e!!e!!ge!\"o$#o##w%y"
|
|
11
|
+
];
|
|
12
|
+
const __ΩPick = [
|
|
13
|
+
"T",
|
|
14
|
+
"K",
|
|
15
|
+
"Pick",
|
|
16
|
+
"l+e#!e\"!fRb!b\"Pde\"\"N#!w#y"
|
|
17
|
+
];
|
|
18
|
+
const __ΩExclude = [
|
|
19
|
+
"T",
|
|
20
|
+
"U",
|
|
21
|
+
"Exclude",
|
|
22
|
+
"l6!Re$!RPe#!e$\"qk#%QRb!b\"Pde\"!p)w#y"
|
|
23
|
+
];
|
|
24
|
+
const __ΩAutoMDPluginOptions = [
|
|
25
|
+
() => __ΩOmit,
|
|
26
|
+
"dir",
|
|
27
|
+
"watch",
|
|
28
|
+
"onWatch",
|
|
29
|
+
"prefix",
|
|
30
|
+
"configFile",
|
|
31
|
+
"Path to the AutoMD configuration file.",
|
|
32
|
+
"allowIssues",
|
|
33
|
+
true,
|
|
34
|
+
"An indicator specifying whether or not issues found by AutoMD during the prepare task are considered fatal.",
|
|
35
|
+
"prefix",
|
|
36
|
+
"[\"automd\", \"powerlines\", \"\\{framework\\}\"]",
|
|
37
|
+
"Alternate prefix strings to use for finding generators",
|
|
38
|
+
false,
|
|
39
|
+
() => __ΩTOCOptions,
|
|
40
|
+
"toc",
|
|
41
|
+
"Table of Contents generator options",
|
|
42
|
+
"AutoMDPluginOptions",
|
|
43
|
+
"P!P.\".#.$.%Jo!#P&4&8?')4(8>)?*P&&FJ4+8>,?-P..n/J408?1MKw2y"
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { __ΩAutoMDPluginOptions };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../plugin-automd/src/types/toc.ts
|
|
3
|
+
const __ΩTOCOptions = [
|
|
4
|
+
"str",
|
|
5
|
+
"",
|
|
6
|
+
"slugify",
|
|
7
|
+
"A slugify function to generate slugs for the headings.",
|
|
8
|
+
"maxDepth",
|
|
9
|
+
6,
|
|
10
|
+
"The maximum depth of headings to include in the TOC.",
|
|
11
|
+
"firstH1",
|
|
12
|
+
"Whether to include the first H1 heading in the TOC.",
|
|
13
|
+
"bullets",
|
|
14
|
+
"-",
|
|
15
|
+
"The bullet character to use for list items in the TOC.",
|
|
16
|
+
"prefix",
|
|
17
|
+
"A prefix to add to each heading in the TOC.",
|
|
18
|
+
"level",
|
|
19
|
+
"filter",
|
|
20
|
+
"A filter function to determine which headings to include in the TOC.",
|
|
21
|
+
"TOCOptions",
|
|
22
|
+
"PP&2!&/\"4#8?$'4%8>&?')4(8?)&4*8>+?,&4-8?.P&2!'2/)/\"408?1Mw2y"
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
exports.__ΩTOCOptions = __ΩTOCOptions;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region ../plugin-automd/src/types/toc.d.ts
|
|
2
|
+
interface TOCOptions {
|
|
3
|
+
/**
|
|
4
|
+
* A slugify function to generate slugs for the headings.
|
|
5
|
+
*/
|
|
6
|
+
slugify?: (str: string) => string;
|
|
7
|
+
/**
|
|
8
|
+
* The maximum depth of headings to include in the TOC.
|
|
9
|
+
*
|
|
10
|
+
* @defaultValue 6
|
|
11
|
+
*/
|
|
12
|
+
maxDepth?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Whether to include the first H1 heading in the TOC.
|
|
15
|
+
*/
|
|
16
|
+
firstH1?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The bullet character to use for list items in the TOC.
|
|
19
|
+
*
|
|
20
|
+
* @defaultValue "-"
|
|
21
|
+
*/
|
|
22
|
+
bullets?: string;
|
|
23
|
+
/**
|
|
24
|
+
* A prefix to add to each heading in the TOC.
|
|
25
|
+
*/
|
|
26
|
+
prefix?: string;
|
|
27
|
+
/**
|
|
28
|
+
* A filter function to determine which headings to include in the TOC.
|
|
29
|
+
*/
|
|
30
|
+
filter?: (str: string, level: number) => boolean;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { TOCOptions };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region ../plugin-automd/src/types/toc.d.ts
|
|
2
|
+
interface TOCOptions {
|
|
3
|
+
/**
|
|
4
|
+
* A slugify function to generate slugs for the headings.
|
|
5
|
+
*/
|
|
6
|
+
slugify?: (str: string) => string;
|
|
7
|
+
/**
|
|
8
|
+
* The maximum depth of headings to include in the TOC.
|
|
9
|
+
*
|
|
10
|
+
* @defaultValue 6
|
|
11
|
+
*/
|
|
12
|
+
maxDepth?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Whether to include the first H1 heading in the TOC.
|
|
15
|
+
*/
|
|
16
|
+
firstH1?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The bullet character to use for list items in the TOC.
|
|
19
|
+
*
|
|
20
|
+
* @defaultValue "-"
|
|
21
|
+
*/
|
|
22
|
+
bullets?: string;
|
|
23
|
+
/**
|
|
24
|
+
* A prefix to add to each heading in the TOC.
|
|
25
|
+
*/
|
|
26
|
+
prefix?: string;
|
|
27
|
+
/**
|
|
28
|
+
* A filter function to determine which headings to include in the TOC.
|
|
29
|
+
*/
|
|
30
|
+
filter?: (str: string, level: number) => boolean;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { TOCOptions };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region ../plugin-automd/src/types/toc.ts
|
|
2
|
+
const __ΩTOCOptions = [
|
|
3
|
+
"str",
|
|
4
|
+
"",
|
|
5
|
+
"slugify",
|
|
6
|
+
"A slugify function to generate slugs for the headings.",
|
|
7
|
+
"maxDepth",
|
|
8
|
+
6,
|
|
9
|
+
"The maximum depth of headings to include in the TOC.",
|
|
10
|
+
"firstH1",
|
|
11
|
+
"Whether to include the first H1 heading in the TOC.",
|
|
12
|
+
"bullets",
|
|
13
|
+
"-",
|
|
14
|
+
"The bullet character to use for list items in the TOC.",
|
|
15
|
+
"prefix",
|
|
16
|
+
"A prefix to add to each heading in the TOC.",
|
|
17
|
+
"level",
|
|
18
|
+
"filter",
|
|
19
|
+
"A filter function to determine which headings to include in the TOC.",
|
|
20
|
+
"TOCOptions",
|
|
21
|
+
"PP&2!&/\"4#8?$'4%8>&?')4(8?)&4*8>+?,&4-8?.P&2!'2/)/\"408?1Mw2y"
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { __ΩTOCOptions };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __babel_generator = require("@babel/generator");
|
|
3
|
+
__babel_generator = require_rolldown_runtime.__toESM(__babel_generator);
|
|
4
|
+
let __babel_parser = require("@babel/parser");
|
|
5
|
+
|
|
6
|
+
//#region ../plugin-babel/src/helpers/ast-utils.ts
|
|
7
|
+
const __ΩRequired = [
|
|
8
|
+
"T",
|
|
9
|
+
"Required",
|
|
10
|
+
"l+e#!e\"!fRb!Pde\"!gN##w\"y"
|
|
11
|
+
];
|
|
12
|
+
const __ΩPick = [
|
|
13
|
+
"T",
|
|
14
|
+
"K",
|
|
15
|
+
"Pick",
|
|
16
|
+
"l+e#!e\"!fRb!b\"Pde\"\"N#!w#y"
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Parse the given code into an AST.
|
|
20
|
+
*
|
|
21
|
+
* @param code - The code to parse.
|
|
22
|
+
* @param opts - The options for parsing.
|
|
23
|
+
* @returns The parsed AST.
|
|
24
|
+
*/
|
|
25
|
+
function parseAst(code, opts = {}) {
|
|
26
|
+
return (0, __babel_parser.parse)(code, {
|
|
27
|
+
plugins: ["typescript"],
|
|
28
|
+
sourceType: "module",
|
|
29
|
+
allowImportExportEverywhere: true,
|
|
30
|
+
allowAwaitOutsideFunction: true,
|
|
31
|
+
...opts
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
parseAst.__type = [
|
|
35
|
+
"code",
|
|
36
|
+
"ParserOptions",
|
|
37
|
+
"opts",
|
|
38
|
+
() => ({}),
|
|
39
|
+
"ParseResult",
|
|
40
|
+
"parseAst",
|
|
41
|
+
"Parse the given code into an AST.",
|
|
42
|
+
"P&2!\"w\"2#>$\"w%/&?'"
|
|
43
|
+
];
|
|
44
|
+
let generate = __babel_generator.default;
|
|
45
|
+
if ("default" in generate) generate = generate.default;
|
|
46
|
+
const __ΩGenerateFromAstOptions = [
|
|
47
|
+
"GeneratorOptions",
|
|
48
|
+
() => __ΩRequired,
|
|
49
|
+
() => __ΩPick,
|
|
50
|
+
"sourceFileName",
|
|
51
|
+
"filename",
|
|
52
|
+
"GenerateFromAstOptions",
|
|
53
|
+
"P\"w!\"w!P.$.%Jo##o\"\"Kw&y"
|
|
54
|
+
];
|
|
55
|
+
function generateFromAst(ast, opts) {
|
|
56
|
+
return generate(ast, opts ? {
|
|
57
|
+
importAttributesKeyword: "with",
|
|
58
|
+
sourceMaps: true,
|
|
59
|
+
...opts
|
|
60
|
+
} : void 0);
|
|
61
|
+
}
|
|
62
|
+
generateFromAst.__type = [
|
|
63
|
+
"ast",
|
|
64
|
+
() => __ΩGenerateFromAstOptions,
|
|
65
|
+
"opts",
|
|
66
|
+
"GeneratorResult",
|
|
67
|
+
"generateFromAst",
|
|
68
|
+
"P!2!n\"2#8\"w$/%"
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
exports.__ΩGenerateFromAstOptions = __ΩGenerateFromAstOptions;
|
|
73
|
+
exports.generateFromAst = generateFromAst;
|
|
74
|
+
exports.parseAst = parseAst;
|